@trilogy-data/trilogy-studio-components 0.1.6 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/dist/{ChatCreatorModal-D32gycfo.js → ChatCreatorModal-B8RhlpPL.js} +1 -1
  2. package/dist/{Dashboard-BEpWQ_lG.js → Dashboard-oBAWlBMW.js} +3 -3
  3. package/dist/{DashboardCreatorInline-B-fIUNyK.js → DashboardCreatorInline-B72GLcaC.js} +1 -1
  4. package/dist/{DashboardMobile-DtUbR8cj.js → DashboardMobile-C-McOG7k.js} +3 -3
  5. package/dist/{LLMConnectionList-C6eBeD7-.js → LLMConnectionList-DPCfgarg.js} +8 -4
  6. package/dist/{LLMView-ButHJ6fv.js → LLMView-B86FIyRN.js} +1 -1
  7. package/dist/Manager-DZ3h9i7j.js +4 -0
  8. package/dist/{ResultComponent-C-FIo-Rd.js → ResultComponent-Dxnrk2Dh.js} +1 -1
  9. package/dist/{Sidebar-0UcM4kHc.js → Sidebar-CJ0BzkLx.js} +3 -3
  10. package/dist/{TutorialPage-CA7L1ghn.js → TutorialPage-BNMNSo5r.js} +4 -4
  11. package/dist/{WelcomePage-BaVZ5Xlm.js → WelcomePage-BYly-Udt.js} +1 -1
  12. package/dist/components/sidebar/LLMConnectionCreator.vue.d.ts.map +1 -1
  13. package/dist/{cssMode-Cr6wkL9u.js → cssMode-BITZe9nD.js} +1 -1
  14. package/dist/{freemarker2-D2TXF0Ei.js → freemarker2-CC2fKKsj.js} +1 -1
  15. package/dist/{handlebars-Dw7G8Qh-.js → handlebars-CEbMNOIs.js} +1 -1
  16. package/dist/{html-CTm9WAqj.js → html-CSdn50VK.js} +1 -1
  17. package/dist/{htmlMode-CSGJkkDk.js → htmlMode-C31BRE4I.js} +1 -1
  18. package/dist/{javascript-CrRL3IGx.js → javascript-BGHDr4vx.js} +1 -1
  19. package/dist/{jsonMode-DneC7Bpk.js → jsonMode-_kL4Z_-N.js} +1 -1
  20. package/dist/{liquid-CqZwZGDq.js → liquid-CYX16zd5.js} +1 -1
  21. package/dist/llm/openrouter.d.ts.map +1 -1
  22. package/dist/{main-BmoSbE_9.js → main-DbIe_w23.js} +40 -41
  23. package/dist/main.css +1 -1
  24. package/dist/main.js +1 -1
  25. package/dist/main.umd.cjs +2 -2
  26. package/dist/{mdx-DtmV7PmJ.js → mdx-CAjFCbvN.js} +1 -1
  27. package/dist/{python-whlFbKu_.js → python-BEj8hRLY.js} +1 -1
  28. package/dist/{razor-Dt3uTt_N.js → razor-C1emroIL.js} +1 -1
  29. package/dist/{tsMode-C88WO3kn.js → tsMode-BAXp9nYi.js} +1 -1
  30. package/dist/{typescript-B6Ztla9f.js → typescript-O4eT6TES.js} +1 -1
  31. package/dist/{useDashboard-JIHdMnMv.js → useDashboard-Bx4sGPt8.js} +1 -1
  32. package/dist/{xml-D9x11trr.js → xml-CfEu4rM8.js} +1 -1
  33. package/dist/{yaml-AiXPOTHt.js → yaml-CHmez3Zn.js} +1 -1
  34. package/package.json +1 -1
  35. package/dist/Manager-CHg0otBl.js +0 -4
package/dist/main.umd.cjs CHANGED
@@ -354,7 +354,7 @@ ${JSON.stringify(r,null,2)}`}const s=e?`Results: ${e.resultSize||0} rows, ${e.co
354
354
  * @license
355
355
  * Copyright 2025 Google LLC
356
356
  * SPDX-License-Identifier: Apache-2.0
357
- */const f1t="gl-node/";class BDe{constructor(e){var t;if(e.apiKey==null)throw new Error("An API Key must be set when running in a browser");if(e.project||e.location)throw new Error("Vertex AI project based authentication is not supported on browser runtimes. Please do not provide a project or location.");this.vertexai=(t=e.vertexai)!==null&&t!==void 0?t:!1,this.apiKey=e.apiKey;const i=S_t(e,void 0,void 0);i&&(e.httpOptions?e.httpOptions.baseUrl=i:e.httpOptions={baseUrl:i}),this.apiVersion=e.apiVersion;const s=new h1t(this.apiKey);this.apiClient=new Vvt({auth:s,apiVersion:this.apiVersion,apiKey:this.apiKey,vertexai:this.vertexai,httpOptions:e.httpOptions,userAgentExtra:f1t+"web",uploader:new c1t}),this.models=new _vt(this.apiClient),this.live=new pvt(this.apiClient,s,new d1t),this.chats=new mwt(this.models,this.apiClient),this.caches=new hwt(this.apiClient),this.files=new Lwt(this.apiClient),this.operations=new Dvt(this.apiClient),this.tunings=new r1t(this.apiClient)}}function Fee(n){const t=n.replace(/^models\//,"").match(/^gemini-(\d+)\.(\d+)(?:-(.+))?$/);return t?{major:parseInt(t[1],10),minor:parseInt(t[2],10),variant:t[3]||null}:null}function FDe(n,e){const t=Fee(n),i=Fee(e);if(!t&&!i)return n.localeCompare(e);if(!t)return 1;if(!i)return-1;if(t.major!==i.major)return i.major-t.major;if(t.minor!==i.minor)return i.minor-t.minor;const s=r=>r?r.startsWith("pro")?1:r.startsWith("flash")?2:3:0;return s(t.variant)-s(i.variant)}const sw=3,Oee=3e4;class Mv extends NH{constructor(t,i,s,r=!1){super(t,i,s,r);$(this,"genAIClient",null);$(this,"baseModelUrl","https://generativelanguage.googleapis.com/v1/models");$(this,"models",[]);$(this,"type","google");this.genAIClient=new BDe({apiKey:this.apiKey})}async reset(){try{this.genAIClient=new BDe({apiKey:this.apiKey})}catch(s){throw console.error("Error initializing Google GenAI client:",s),new Error(`Failed to initialize Google GenAI client: ${s instanceof Error?s.message:String(s)}`)}this.error=null;let t=0,i=!1;for(;!i&&t<=sw;)try{const s=await fetch(`${this.baseModelUrl}?key=${this.apiKey}`,{method:"GET"});if(s.status===429&&(t++,t<=sw)){const a=Oee*Math.pow(2,t-1);console.log(`Rate limited (429). Retry ${t}/${sw} after ${a}ms`),await new Promise(l=>setTimeout(l,a));continue}if(!s.ok)throw new Error(`Google API error: ${s.status} ${s.statusText}`);const o=(await s.json()).models.map(a=>a.name);this.models=Mv.filterModels(o),this.connected=!0,i=!0}catch(s){if(t>=sw)throw s instanceof Error?this.error=s.message:this.error="Unknown error",this.connected=!1,new Error(`Failed to fetch models after ${sw} retries: ${this.error}`);t++;const r=Oee*Math.pow(2,t-1);console.log(`Error fetching models. Retry ${t}/${sw} after ${r}ms`),await new Promise(o=>setTimeout(o,r))}}async withRetry(t,i,s){let r=0;for(;;){if(s!=null&&s.aborted)throw new DOMException("Aborted","AbortError");try{return await t()}catch(o){if(o instanceof DOMException&&o.name==="AbortError"||!(o instanceof Error&&(o.message.includes("429")||o.message.toLowerCase().includes("rate limit"))||o instanceof Response&&o.status===429)||r>=sw)throw o;r++;const l=Oee*Math.pow(2,r-1);console.log(`Rate limited (429). Retry ${r}/${sw} after ${l}ms`),i&&o instanceof Error&&i(r,l,o),await new Promise((c,d)=>{const u=setTimeout(c,l);s&&s.addEventListener("abort",()=>{clearTimeout(u),d(new DOMException("Aborted","AbortError"))},{once:!0})})}}}async generateCompletion(t,i=null){if(console.log("gemini generating with"),console.log(i),this.validateRequestOptions(t),!this.genAIClient)throw new Error("Google GenAI client is not initialized");return await this.withRetry(async()=>{var s,r,o,a;if(i&&i.length>0){console.log(this.convertToGeminiHistory(i));const l={model:this.model.includes("/")?this.model.split("/")[1]:this.model,history:this.convertToGeminiHistory(i),config:{maxOutputTokens:t.maxTokens||xee,temperature:t.temperature||Eee,tools:t.tools&&t.tools.length>0?this.convertToGeminiTools(t.tools):void 0}},d=await this.genAIClient.chats.create(l).sendMessage({message:t.prompt}),u=((s=d.usageMetadata)==null?void 0:s.promptTokenCount)||0,f=((r=d.usageMetadata)==null?void 0:r.candidatesTokenCount)||0,{text:g,toolCalls:p}=this.extractResponseData(d);return{text:g,toolCalls:p.length>0?p:void 0,usage:{promptTokens:u,completionTokens:f,totalTokens:u+f}}}else{console.log("using simple completion without history");const l={model:this.model.includes("/")?this.model.split("/")[1]:this.model,contents:t.prompt,config:{maxOutputTokens:t.maxTokens||xee,temperature:t.temperature||Eee,tools:t.tools&&t.tools.length>0?this.convertToGeminiTools(t.tools):void 0}},c=await this.genAIClient.models.generateContent(l),d=((o=c.usageMetadata)==null?void 0:o.promptTokenCount)||0,u=((a=c.usageMetadata)==null?void 0:a.candidatesTokenCount)||0,{text:f,toolCalls:g}=this.extractResponseData(c);return{text:f,toolCalls:g.length>0?g:void 0,usage:{promptTokens:d,completionTokens:u,totalTokens:d+u}}}},t.onRateLimitBackoff,t.signal)}convertToGeminiTools(t){return[{functionDeclarations:t.map(s=>({name:s.name,description:s.description,parameters:{type:Lee.OBJECT,properties:s.input_schema.properties,required:s.input_schema.required?[...s.input_schema.required]:void 0}}))}]}extractResponseData(t){let i="";const s=[],r=t.candidates||[];let o=0;for(const a of r){const l=a.content;if(!(!l||!l.parts))for(const c of l.parts)c.text?i+=c.text:c.functionCall&&s.push({id:`google_tool_${o++}`,name:c.functionCall.name,input:c.functionCall.args})}return{text:i||t.text||"",toolCalls:s}}convertToGeminiHistory(t){const i=[];for(let s=0;s<t.length;s++){const r=t[s],o=r.role==="assistant"?"model":"user";if(r.role==="assistant"&&r.toolCalls&&r.toolCalls.length>0){const l=[];r.content&&l.push({text:r.content});for(const c of r.toolCalls)l.push({functionCall:{name:c.name,args:c.input}});i.push({parts:l,role:"model"})}else if(r.role==="user"&&r.toolResults&&r.toolResults.length>0){const l=r.toolResults.map(c=>({functionResponse:{name:c.toolName,response:{result:c.result}}}));i.push({parts:l,role:"user"})}else i.push({parts:[{text:r.content}],role:o});const a=t[s+1];o==="user"&&a&&(a.role==="assistant"?"model":"user")==="user"&&i.push({parts:[{text:"Thanks!"}],role:"model"})}return i}static filterModels(t){return t.filter(i=>Fee(i)!==null).sort(FDe)}static getDefaultModel(t){return[...t].sort(FDe)[0]||""}}const g1t=[/^anthropic\/claude-(?:3|4|opus|sonnet|haiku)/,/^openai\/gpt-(?:4|5)/,/^openai\/o[1-9]/,/^google\/gemini-(?:1\.5|2\.|pro|flash|ultra)/,/^meta-llama\/llama-(?:3|4)/,/^meta-llama\/llama-guard/,/^mistral(?:ai)?\/mistral-(?:large|medium|small)/,/^mistral(?:ai)?\/mixtral/,/^mistral(?:ai)?\/codestral/,/^mistral(?:ai)?\/ministral/,/^mistral(?:ai)?\/pixtral/,/^deepseek\//,/^qwen\/qwen-(?:2|3)/,/^qwen\/qwq/,/^cohere\/command-(?:r|a)/,/^x-ai\/grok/,/^perplexity\//,/^nousresearch\/hermes-3/,/^microsoft\/phi-(?:3|4)/,/^microsoft\/wizardlm/];function ODe(n){const e=n.split("/");return e.length>=2?{provider:e[0],modelName:e.slice(1).join("/")}:{provider:"",modelName:n}}function PDe(n){const e=n.toLowerCase();return e.includes("opus")||e.includes("ultra")||e.includes("-large")||e.includes("gpt-5")||e.includes("o1-pro")||e.includes("o3")?"flagship":/-mini\b/.test(e)||/\/mini\b/.test(e)||e.includes("haiku")||e.includes("flash")||e.includes("-small")||e.includes("instant")?"mini":e.includes("sonnet")||e.includes("medium")||/-pro\b/.test(e)||e.endsWith("-pro")||e.endsWith("pro")||e.includes("gpt-4")?"standard":"other"}function VDe(n){const e=n.match(/[/-](\d+)(?:\.(\d+))?(?:\.(\d+))?(?:[a-z])?(?:[/-]|$)/i);return e?{major:parseInt(e[1],10),minor:e[2]?parseInt(e[2],10):0,patch:e[3]?parseInt(e[3],10):0}:null}function p1t(n,e){const t=ODe(n),i=ODe(e),s={anthropic:0,openai:1,google:2,"x-ai":3,"meta-llama":4,mistralai:5,mistral:5,deepseek:6,qwen:7,cohere:8,perplexity:9},r=s[t.provider]??99,o=s[i.provider]??99;if(r!==o)return r-o;const a={flagship:0,standard:1,mini:2,other:3},l=PDe(n),c=PDe(e);if(l!==c)return a[l]-a[c];const d=VDe(n),u=VDe(e);return d&&u?d.major!==u.major?u.major-d.major:d.minor!==u.minor?u.minor-d.minor:u.patch-d.patch:d?-1:u?1:n.localeCompare(e)}class qH extends NH{constructor(t,i,s,r=!1,o,a){super(t,i,s,r);$(this,"baseCompletionUrl","https://openrouter.ai/api/v1/chat/completions");$(this,"baseModelUrl","https://openrouter.ai/api/v1/models");$(this,"models",[]);$(this,"modelMetadata",new Map);$(this,"type","openrouter");$(this,"retryOptions");$(this,"httpReferer");$(this,"appTitle");this.httpReferer=a==null?void 0:a.httpReferer,this.appTitle=a==null?void 0:a.appTitle,this.retryOptions=o||{maxRetries:3,initialDelayMs:1e3,retryStatusCodes:[429,500,502,503,504],onRetry:(l,c,d)=>{console.warn(`OpenRouter API retry attempt ${l} after ${c}ms delay due to error: ${d.message}`)}}}getHeaders(){const t={"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`};return this.httpReferer&&(t["HTTP-Referer"]=this.httpReferer),this.appTitle&&(t["X-Title"]=this.appTitle),t}async reset(){this.error=null;try{const s=(await(await rT(()=>fetch(this.baseModelUrl,{headers:this.getHeaders(),method:"GET"}),this.retryOptions)).json()).data||[];this.modelMetadata.clear();for(const o of s)this.modelMetadata.set(o.id,o);const r=s.map(o=>o.id);this.models=qH.filterModels(r),this.connected=!0}catch(t){throw t instanceof Error?this.error=t.message:this.error="Unknown error",this.connected=!1,t}}async generateCompletion(t,i=null){var a,l,c,d,u,f;this.validateRequestOptions(t);const s=[];for(const g of i||[])if(g.role==="assistant"&&g.toolCalls&&g.toolCalls.length>0)s.push({role:"assistant",content:g.content||null,tool_calls:g.toolCalls.map(p=>({id:p.id,type:"function",function:{name:p.name,arguments:JSON.stringify(p.input)}}))});else if(g.role==="user"&&g.toolResults&&g.toolResults.length>0)for(const p of g.toolResults)s.push({role:"tool",tool_call_id:p.toolCallId,content:p.result});else s.push({role:g.role,content:g.content});let r=[];t.systemPrompt&&r.push({role:"system",content:t.systemPrompt}),r=[...r,...s],t.prompt&&r.push({role:"user",content:t.prompt});const o={model:this.model,messages:r};t.maxTokens&&(o.max_tokens=t.maxTokens),t.temperature!==void 0&&(o.temperature=t.temperature),t.topP!==void 0&&(o.top_p=t.topP),t.tools&&t.tools.length>0&&(o.tools=t.tools.map(g=>({type:"function",function:{name:g.name,description:g.description,parameters:g.input_schema}})));try{const g={...this.retryOptions,signal:t.signal,onRetry:(w,C,E)=>{var S,x,k;(x=(S=this.retryOptions).onRetry)==null||x.call(S,w,C,E),(k=t.onRateLimitBackoff)==null||k.call(t,w,C,E)}},m=await(await rT(()=>fetch(this.baseCompletionUrl,{method:"POST",headers:this.getHeaders(),body:JSON.stringify(o),signal:t.signal}),g)).json();if(m.error)throw new Error(`OpenRouter API error: ${m.error.message||JSON.stringify(m.error)}`);let A=((c=(l=(a=m.choices)==null?void 0:a[0])==null?void 0:l.message)==null?void 0:c.content)||"";const b=(f=(u=(d=m.choices)==null?void 0:d[0])==null?void 0:u.message)==null?void 0:f.tool_calls,y=[];if(b&&b.length>0){for(const w of b)if(w.type==="function"){const C=JSON.parse(w.function.arguments);y.push({id:w.id,name:w.function.name,input:C})}}const _=m.usage||{};return{text:A,toolCalls:y.length>0?y:void 0,usage:{promptTokens:_.prompt_tokens||0,completionTokens:_.completion_tokens||0,totalTokens:_.total_tokens||0}}}catch(g){throw g instanceof Error?new Error(`OpenRouter API error: ${g.message}`):g}}getModelMetadata(t){return this.modelMetadata.get(t)}static filterModels(t){return t.filter(i=>g1t.some(s=>s.test(i))).sort(p1t)}static getDefaultModel(t){const i=["anthropic/claude-sonnet-4","anthropic/claude-3.5-sonnet","anthropic/claude-3-5-sonnet","openai/gpt-4o","openai/gpt-4-turbo","google/gemini-2.0-flash"];for(const s of i){const r=t.find(o=>o===s||o.startsWith(s));if(r)return r}return t[0]||""}static getOAuthAuthorizationUrl(t){const i=new URLSearchParams({callback_url:t.callbackUrl});return t.codeChallenge&&i.set("code_challenge",t.codeChallenge),t.codeChallengeMethod&&i.set("code_challenge_method",t.codeChallengeMethod),`https://openrouter.ai/auth?${i.toString()}`}static async exchangeCodeForApiKey(t,i){const s={code:t};i&&(s.code_verifier=i);const r=await fetch("https://openrouter.ai/api/v1/auth/keys",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!r.ok){const a=await r.json().catch(()=>({message:"Unknown error"}));throw new Error(`Failed to exchange code for API key: ${a.message||r.statusText}`)}return(await r.json()).key}static generateCodeVerifier(){const t=new Uint8Array(32);return crypto.getRandomValues(t),btoa(String.fromCharCode(...t)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}static async generateCodeChallenge(t){const s=new TextEncoder().encode(t),r=await crypto.subtle.digest("SHA-256",s),o=new Uint8Array(r);return btoa(String.fromCharCode(...o)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}}function m1t(n){const e=n.filter(i=>i.role!=="system"&&!i.hidden).slice(0,10);return e.length===0?"Generate a short, descriptive name for a new chat conversation. Return only the name, nothing else. Maximum 5 words.":`Based on the following conversation, generate a short, descriptive name (3-5 words max) that captures the main topic or purpose. Return ONLY the name, nothing else. No quotes, no explanation.
357
+ */const f1t="gl-node/";class BDe{constructor(e){var t;if(e.apiKey==null)throw new Error("An API Key must be set when running in a browser");if(e.project||e.location)throw new Error("Vertex AI project based authentication is not supported on browser runtimes. Please do not provide a project or location.");this.vertexai=(t=e.vertexai)!==null&&t!==void 0?t:!1,this.apiKey=e.apiKey;const i=S_t(e,void 0,void 0);i&&(e.httpOptions?e.httpOptions.baseUrl=i:e.httpOptions={baseUrl:i}),this.apiVersion=e.apiVersion;const s=new h1t(this.apiKey);this.apiClient=new Vvt({auth:s,apiVersion:this.apiVersion,apiKey:this.apiKey,vertexai:this.vertexai,httpOptions:e.httpOptions,userAgentExtra:f1t+"web",uploader:new c1t}),this.models=new _vt(this.apiClient),this.live=new pvt(this.apiClient,s,new d1t),this.chats=new mwt(this.models,this.apiClient),this.caches=new hwt(this.apiClient),this.files=new Lwt(this.apiClient),this.operations=new Dvt(this.apiClient),this.tunings=new r1t(this.apiClient)}}function Fee(n){const t=n.replace(/^models\//,"").match(/^gemini-(\d+)\.(\d+)(?:-(.+))?$/);return t?{major:parseInt(t[1],10),minor:parseInt(t[2],10),variant:t[3]||null}:null}function FDe(n,e){const t=Fee(n),i=Fee(e);if(!t&&!i)return n.localeCompare(e);if(!t)return 1;if(!i)return-1;if(t.major!==i.major)return i.major-t.major;if(t.minor!==i.minor)return i.minor-t.minor;const s=r=>r?r.startsWith("pro")?1:r.startsWith("flash")?2:3:0;return s(t.variant)-s(i.variant)}const sw=3,Oee=3e4;class Mv extends NH{constructor(t,i,s,r=!1){super(t,i,s,r);$(this,"genAIClient",null);$(this,"baseModelUrl","https://generativelanguage.googleapis.com/v1/models");$(this,"models",[]);$(this,"type","google");this.genAIClient=new BDe({apiKey:this.apiKey})}async reset(){try{this.genAIClient=new BDe({apiKey:this.apiKey})}catch(s){throw console.error("Error initializing Google GenAI client:",s),new Error(`Failed to initialize Google GenAI client: ${s instanceof Error?s.message:String(s)}`)}this.error=null;let t=0,i=!1;for(;!i&&t<=sw;)try{const s=await fetch(`${this.baseModelUrl}?key=${this.apiKey}`,{method:"GET"});if(s.status===429&&(t++,t<=sw)){const a=Oee*Math.pow(2,t-1);console.log(`Rate limited (429). Retry ${t}/${sw} after ${a}ms`),await new Promise(l=>setTimeout(l,a));continue}if(!s.ok)throw new Error(`Google API error: ${s.status} ${s.statusText}`);const o=(await s.json()).models.map(a=>a.name);this.models=Mv.filterModels(o),this.connected=!0,i=!0}catch(s){if(t>=sw)throw s instanceof Error?this.error=s.message:this.error="Unknown error",this.connected=!1,new Error(`Failed to fetch models after ${sw} retries: ${this.error}`);t++;const r=Oee*Math.pow(2,t-1);console.log(`Error fetching models. Retry ${t}/${sw} after ${r}ms`),await new Promise(o=>setTimeout(o,r))}}async withRetry(t,i,s){let r=0;for(;;){if(s!=null&&s.aborted)throw new DOMException("Aborted","AbortError");try{return await t()}catch(o){if(o instanceof DOMException&&o.name==="AbortError"||!(o instanceof Error&&(o.message.includes("429")||o.message.toLowerCase().includes("rate limit"))||o instanceof Response&&o.status===429)||r>=sw)throw o;r++;const l=Oee*Math.pow(2,r-1);console.log(`Rate limited (429). Retry ${r}/${sw} after ${l}ms`),i&&o instanceof Error&&i(r,l,o),await new Promise((c,d)=>{const u=setTimeout(c,l);s&&s.addEventListener("abort",()=>{clearTimeout(u),d(new DOMException("Aborted","AbortError"))},{once:!0})})}}}async generateCompletion(t,i=null){if(console.log("gemini generating with"),console.log(i),this.validateRequestOptions(t),!this.genAIClient)throw new Error("Google GenAI client is not initialized");return await this.withRetry(async()=>{var s,r,o,a;if(i&&i.length>0){console.log(this.convertToGeminiHistory(i));const l={model:this.model.includes("/")?this.model.split("/")[1]:this.model,history:this.convertToGeminiHistory(i),config:{maxOutputTokens:t.maxTokens||xee,temperature:t.temperature||Eee,tools:t.tools&&t.tools.length>0?this.convertToGeminiTools(t.tools):void 0}},d=await this.genAIClient.chats.create(l).sendMessage({message:t.prompt}),u=((s=d.usageMetadata)==null?void 0:s.promptTokenCount)||0,f=((r=d.usageMetadata)==null?void 0:r.candidatesTokenCount)||0,{text:g,toolCalls:p}=this.extractResponseData(d);return{text:g,toolCalls:p.length>0?p:void 0,usage:{promptTokens:u,completionTokens:f,totalTokens:u+f}}}else{console.log("using simple completion without history");const l={model:this.model.includes("/")?this.model.split("/")[1]:this.model,contents:t.prompt,config:{maxOutputTokens:t.maxTokens||xee,temperature:t.temperature||Eee,tools:t.tools&&t.tools.length>0?this.convertToGeminiTools(t.tools):void 0}},c=await this.genAIClient.models.generateContent(l),d=((o=c.usageMetadata)==null?void 0:o.promptTokenCount)||0,u=((a=c.usageMetadata)==null?void 0:a.candidatesTokenCount)||0,{text:f,toolCalls:g}=this.extractResponseData(c);return{text:f,toolCalls:g.length>0?g:void 0,usage:{promptTokens:d,completionTokens:u,totalTokens:d+u}}}},t.onRateLimitBackoff,t.signal)}convertToGeminiTools(t){return[{functionDeclarations:t.map(s=>({name:s.name,description:s.description,parameters:{type:Lee.OBJECT,properties:s.input_schema.properties,required:s.input_schema.required?[...s.input_schema.required]:void 0}}))}]}extractResponseData(t){let i="";const s=[],r=t.candidates||[];let o=0;for(const a of r){const l=a.content;if(!(!l||!l.parts))for(const c of l.parts)c.text?i+=c.text:c.functionCall&&s.push({id:`google_tool_${o++}`,name:c.functionCall.name,input:c.functionCall.args})}return{text:i||t.text||"",toolCalls:s}}convertToGeminiHistory(t){const i=[];for(let s=0;s<t.length;s++){const r=t[s],o=r.role==="assistant"?"model":"user";if(r.role==="assistant"&&r.toolCalls&&r.toolCalls.length>0){const l=[];r.content&&l.push({text:r.content});for(const c of r.toolCalls)l.push({functionCall:{name:c.name,args:c.input}});i.push({parts:l,role:"model"})}else if(r.role==="user"&&r.toolResults&&r.toolResults.length>0){const l=r.toolResults.map(c=>({functionResponse:{name:c.toolName,response:{result:c.result}}}));i.push({parts:l,role:"user"})}else i.push({parts:[{text:r.content}],role:o});const a=t[s+1];o==="user"&&a&&(a.role==="assistant"?"model":"user")==="user"&&i.push({parts:[{text:"Thanks!"}],role:"model"})}return i}static filterModels(t){return t.filter(i=>Fee(i)!==null).sort(FDe)}static getDefaultModel(t){return[...t].sort(FDe)[0]||""}}const g1t=[/^anthropic\/claude-/,/^openai\/gpt-[4-9]/,/^openai\/o[1-9]/,/^google\/gemini-/,/^meta-llama\/llama-[3-9]/,/^meta-llama\/llama-guard/,/^mistral(?:ai)?\/mistral-(?:large|medium|small)/,/^mistral(?:ai)?\/mixtral/,/^mistral(?:ai)?\/codestral/,/^mistral(?:ai)?\/ministral/,/^mistral(?:ai)?\/pixtral/,/^deepseek\//,/^qwen\/qwen-[2-9]/,/^qwen\/qwq/,/^cohere\/command-(?:r|a)/,/^x-ai\/grok/,/^perplexity\//,/^nousresearch\/hermes-[3-9]/,/^microsoft\/phi-[3-9]/,/^microsoft\/wizardlm/];function ODe(n){const e=n.split("/");return e.length>=2?{provider:e[0],modelName:e.slice(1).join("/")}:{provider:"",modelName:n}}function PDe(n){const e=n.toLowerCase();return e.includes("opus")||e.includes("ultra")||e.includes("-large")||/gpt-[5-9]/.test(e)||e.includes("o1-pro")||/\/o[3-9]/.test(e)?"flagship":/-mini\b/.test(e)||/\/mini\b/.test(e)||e.includes("haiku")||e.includes("flash")||e.includes("-small")||e.includes("instant")?"mini":e.includes("sonnet")||e.includes("medium")||/-pro\b/.test(e)||e.endsWith("-pro")||e.endsWith("pro")||e.includes("gpt-4")?"standard":"other"}function VDe(n){const e=n.match(/[/-](\d+)(?:\.(\d+))?(?:\.(\d+))?(?:[a-z])?(?:[/-]|$)/i);return e?{major:parseInt(e[1],10),minor:e[2]?parseInt(e[2],10):0,patch:e[3]?parseInt(e[3],10):0}:null}function p1t(n,e){const t=ODe(n),i=ODe(e),s={anthropic:0,openai:1,google:2,"x-ai":3,"meta-llama":4,mistralai:5,mistral:5,deepseek:6,qwen:7,cohere:8,perplexity:9},r=s[t.provider]??99,o=s[i.provider]??99;if(r!==o)return r-o;const a={flagship:0,standard:1,mini:2,other:3},l=PDe(n),c=PDe(e);if(l!==c)return a[l]-a[c];const d=VDe(n),u=VDe(e);return d&&u?d.major!==u.major?u.major-d.major:d.minor!==u.minor?u.minor-d.minor:u.patch-d.patch:d?-1:u?1:n.localeCompare(e)}class qH extends NH{constructor(t,i,s,r=!1,o,a){super(t,i,s,r);$(this,"baseCompletionUrl","https://openrouter.ai/api/v1/chat/completions");$(this,"baseModelUrl","https://openrouter.ai/api/v1/models");$(this,"models",[]);$(this,"modelMetadata",new Map);$(this,"type","openrouter");$(this,"retryOptions");$(this,"httpReferer");$(this,"appTitle");this.httpReferer=a==null?void 0:a.httpReferer,this.appTitle=a==null?void 0:a.appTitle,this.retryOptions=o||{maxRetries:3,initialDelayMs:1e3,retryStatusCodes:[429,500,502,503,504],onRetry:(l,c,d)=>{console.warn(`OpenRouter API retry attempt ${l} after ${c}ms delay due to error: ${d.message}`)}}}getHeaders(){const t={"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`};return this.httpReferer&&(t["HTTP-Referer"]=this.httpReferer),this.appTitle&&(t["X-Title"]=this.appTitle),t}async reset(){this.error=null;try{const s=(await(await rT(()=>fetch(this.baseModelUrl,{headers:this.getHeaders(),method:"GET"}),this.retryOptions)).json()).data||[];this.modelMetadata.clear();for(const o of s)this.modelMetadata.set(o.id,o);const r=s.map(o=>o.id);this.models=qH.filterModels(r),this.connected=!0}catch(t){throw t instanceof Error?this.error=t.message:this.error="Unknown error",this.connected=!1,t}}async generateCompletion(t,i=null){var a,l,c,d,u,f;this.validateRequestOptions(t);const s=[];for(const g of i||[])if(g.role==="assistant"&&g.toolCalls&&g.toolCalls.length>0)s.push({role:"assistant",content:g.content||null,tool_calls:g.toolCalls.map(p=>({id:p.id,type:"function",function:{name:p.name,arguments:JSON.stringify(p.input)}}))});else if(g.role==="user"&&g.toolResults&&g.toolResults.length>0)for(const p of g.toolResults)s.push({role:"tool",tool_call_id:p.toolCallId,content:p.result});else s.push({role:g.role,content:g.content});let r=[];t.systemPrompt&&r.push({role:"system",content:t.systemPrompt}),r=[...r,...s],t.prompt&&r.push({role:"user",content:t.prompt});const o={model:this.model,messages:r};t.maxTokens&&(o.max_tokens=t.maxTokens),t.temperature!==void 0&&(o.temperature=t.temperature),t.topP!==void 0&&(o.top_p=t.topP),t.tools&&t.tools.length>0&&(o.tools=t.tools.map(g=>({type:"function",function:{name:g.name,description:g.description,parameters:g.input_schema}})));try{const g={...this.retryOptions,signal:t.signal,onRetry:(w,C,E)=>{var S,x,k;(x=(S=this.retryOptions).onRetry)==null||x.call(S,w,C,E),(k=t.onRateLimitBackoff)==null||k.call(t,w,C,E)}},m=await(await rT(()=>fetch(this.baseCompletionUrl,{method:"POST",headers:this.getHeaders(),body:JSON.stringify(o),signal:t.signal}),g)).json();if(m.error)throw new Error(`OpenRouter API error: ${m.error.message||JSON.stringify(m.error)}`);let A=((c=(l=(a=m.choices)==null?void 0:a[0])==null?void 0:l.message)==null?void 0:c.content)||"";const b=(f=(u=(d=m.choices)==null?void 0:d[0])==null?void 0:u.message)==null?void 0:f.tool_calls,y=[];if(b&&b.length>0){for(const w of b)if(w.type==="function"){const C=JSON.parse(w.function.arguments);y.push({id:w.id,name:w.function.name,input:C})}}const _=m.usage||{};return{text:A,toolCalls:y.length>0?y:void 0,usage:{promptTokens:_.prompt_tokens||0,completionTokens:_.completion_tokens||0,totalTokens:_.total_tokens||0}}}catch(g){throw g instanceof Error?new Error(`OpenRouter API error: ${g.message}`):g}}getModelMetadata(t){return this.modelMetadata.get(t)}static filterModels(t){return t.filter(i=>g1t.some(s=>s.test(i))).sort(p1t)}static getDefaultModel(t){const i=["anthropic/claude-sonnet-4","anthropic/claude-3.5-sonnet","anthropic/claude-3-5-sonnet","openai/gpt-4o","openai/gpt-4-turbo","google/gemini-2.0-flash"];for(const s of i){const r=t.find(o=>o===s||o.startsWith(s));if(r)return r}return t[0]||""}static getOAuthAuthorizationUrl(t){const i=new URLSearchParams({callback_url:t.callbackUrl});return t.codeChallenge&&i.set("code_challenge",t.codeChallenge),t.codeChallengeMethod&&i.set("code_challenge_method",t.codeChallengeMethod),`https://openrouter.ai/auth?${i.toString()}`}static async exchangeCodeForApiKey(t,i){const s={code:t};i&&(s.code_verifier=i);const r=await fetch("https://openrouter.ai/api/v1/auth/keys",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!r.ok){const a=await r.json().catch(()=>({message:"Unknown error"}));throw new Error(`Failed to exchange code for API key: ${a.message||r.statusText}`)}return(await r.json()).key}static generateCodeVerifier(){const t=new Uint8Array(32);return crypto.getRandomValues(t),btoa(String.fromCharCode(...t)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}static async generateCodeChallenge(t){const s=new TextEncoder().encode(t),r=await crypto.subtle.digest("SHA-256",s),o=new Uint8Array(r);return btoa(String.fromCharCode(...o)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}}function m1t(n){const e=n.filter(i=>i.role!=="system"&&!i.hidden).slice(0,10);return e.length===0?"Generate a short, descriptive name for a new chat conversation. Return only the name, nothing else. Maximum 5 words.":`Based on the following conversation, generate a short, descriptive name (3-5 words max) that captures the main topic or purpose. Return ONLY the name, nothing else. No quotes, no explanation.
358
358
 
359
359
  Conversation:
360
360
  ${e.map(i=>{const s=i.role==="user"?"User":"Assistant",r=i.content.length>200?i.content.substring(0,200)+"...":i.content;return`${s}: ${r}`}).join(`
@@ -2901,7 +2901,7 @@ SELECT
2901
2901
  @pretty_percent(number) AS percent,
2902
2902
  @pretty_percent(number, 3) AS three_percent
2903
2903
  ;`,"code")]),BQn]),OQn=new yG("Terms of Service",[new cr("Terms of Service",[new ne("Last Updated","February 22, 2025"),new ne("Service Description",'Trilogy Studio (referred to as "IDE" henceforth) enables users to interact with public data or data in databases they own. The IDE communicates with non-user services only to do basic telemetry and preprocessing of Trilogy code using the default language server (if a local one is not configured). The primary purpose of this preprocessing is to generate SQL to be returned to the browser for execution.',"section"),new ne("Data Privacy and Security","No Data Collection: We do not collect, store, or process any of your data or database contents, beyond metadata provided in the model definition. All database interactions occur directly between your browser and your database through client-side JavaScript.","section"),new ne("Local Processing","All code execution and data processing occur locally in your browser. We have no access to your database credentials, queries, or results.","subsection"),new ne("User Responsibility","You are solely responsible for securing your database connections, managing database credentials, implementing appropriate security measures, backing up your data, and ensuring compliance with applicable data protection laws.","subsection"),new ne("Service Limitations","Browser Limitations: The IDE is subject to your browser's technical limitations, including memory constraints and processing capabilities.","section"),new ne("Connection Requirements","Stable internet connection required for IDE access. Database connectivity depends on your database configuration and network conditions.","subsection"),new ne("User Obligations","You agree to use the IDE in compliance with applicable laws, not attempt to circumvent browser security measures, not use the IDE for illegal or unauthorized purposes, maintain the security of your database credentials, and not redistribute or modify the IDE code without permission.","section"),new ne("Disclaimers",'Service Availability: We provide the IDE "as is" and make no guarantees about its availability or functionality.',"section"),new ne("Security Disclaimer","While we implement standard security measures in our code, we cannot guarantee the security of your database connections or local environment.","subsection"),new ne("Liability Limitations","We are not liable for data loss or corruption, database connection issues, browser performance problems, security breaches in your database, misuse of the IDE, or consequential damages.","section"),new ne("User Rights","You retain all rights to your code, your database, your data, and any outputs generated using the IDE.","subsection"),new ne("Modifications","We reserve the right to modify the IDE functionality, these Terms of Service, and supported features and libraries.","section"),new ne("Termination","You may stop using the IDE at any time.","section"),new ne("Contact","For questions about these terms, please create an issue on the github repository <a href='https://github.com/trilogy-data/trilogy-studio-core'>here</a>.","section"),new ne("Agreement","By using the IDE, you agree to these terms and conditions.","conclusion")])]),_G=[new yG("Studio",[DQn,LQn,IQn,NQn,new cr("Functionality",[new ne("Tip","Trilogy Studio is a statically hosted website that uses a mix of precompiled scripts and dynamic imports for some connections to reduce bundle size."),new ne("Tip","For Trilogy specific features, the studio relies on a pseudo-language server (there is a proper LSP available for vs-code, used in the vs-code extension, as well). By default this will use a cloud-hosted backend but studio can be configured to use a local address as well. "),new ne("Tip","Trilogy Studio requires internet access to download certain dependencies - such as DuckDB WASM - on demand when utilizing a relevant connection. It can then be used offline if a local backend server is running. A pure offline option may be available in the future.","tip")]),new cr("Navigation",[new ne("Navigation","On desktop, Trilogy Studio uses a left-hand navigation bar, a sidebar with context, and a main pane (which may be split) to present information. The sidebar is further split into sections; the first icons change the sidebar for the query editor, while the next section configures entirely new main screen experiences. Configuration/profile are accessible at the bottom. On mobile, Trilogy will instead use a top menu to access a navigation screen, and the main display will show only one particular field at a time."),new ne("Tip","Don't forget to save! By default, Trilogy Studio stores your editors, connections, and models in browser local storage. Use the save buttons on the left-hand nav to record changes. You can also use the keyboard shortcuts Ctrl + S to save your work.","tip")]),new cr("Querying",[new ne("Querying","A core goal of Trilogy Studio is to enable seamless running of Trilogy against backends. Raw SQL is fully supported as well to help with debugging, diagnostics, and other development tasks."),new ne("Editor Selection","When creating an editor, you will select a type. Trilogy editors run Trilogy code; SQL editors run SQL. An editor must be associated with a connection and may be associated with a model."),new ne("Query Execution","When running Trilogy queries, your command will first go to a backend server to be parsed/type-checked, then the output SQL will be returned to the editor to be run as a normal SQL query. SQL editors will submit directly to the configured connection without the first parsing pass.")]),new cr("Connections",[new ne("Connections","Editors must be associated with a connection. A connection represents a particular underlying backend database resource. Many IDEs can share one connection, but only a single query can be executed on a connection at a single point in time. Connections are also associated with a model, which enables configuration of additional editors as semantic sources."),new ne("Managing Connections","You can view current connections below. Edit the model associated with a connection by clicking the model name next to it (or 'set model' if not set). Connections will not automatically connect on startup by default; click the connection button to connect. This connection view is always accessible through the connections page on the left side."),new ne("ConnectionList","","connections")]),new cr("DuckDB",[new ne("DuckDB","DuckDB is always available as an in-browser database using the DuckDB WASM integration. No authentication is required. DuckDB also natively supports csv uploads through a widget available on the connection view. Most community duckdb models will reference publically available CSV or parquet files.")]),new cr("Bigquery",[new ne("Connections",'Bigquery is supported through Oauth authentication as your identity. If you wish to use a service key file, please upvote this github issue: <a href="https://github.com/trilogy-data/trilogy-studio-core/issues/33" target="_blank">BQ Service Account Support</a>.')]),new cr("Snowflake",[new ne("Connections",'Snowflake is supported with private key authentication. Read more at this link: <a href="https://docs.snowflake.com/en/user-guide/key-pair-auth" target="_blank">Snowflake Private Key Pairs</a>. You will need to provide the private key to connect after configuring your user with the public key portion. The rest of the authentication header can be derived from this. Remember to use caution of saving this key.')]),new cr("Scheduling",[new ne("Scheduling",'Scheduling dashboards/scripts is a future feature. Please upvote this github issue: <a href="https://github.com/trilogy-data/trilogy-studio-core/issues/75" target="_blank">Scheduling</a>.')])]),FQn,new yG("Privacy And Data",[new cr("Privacy Policy",[new ne("Last Updated","February 22, 2025"),new ne("Introduction","This Privacy Policy explains how Trilogy Studio handles your information. While most processing occurs in your browser, we utilize some external services to enhance your development experience.","section"),new ne("Information We Collect","Telemetry: We collect feature usage counts and patterns and coarse browser/geographic information to inform product decision and system performance using GoatTrack. This data is anonymous and does not include any personally identifiable information. Telemetry can be disabled in settings.","section"),new ne("Query Processing","We process Trilogy queries to transform them to SQL based on your model inputs if you use the default query service. Results are returned to your browser for execution. No actual database connections or credentials are transmitted.","subsection"),new ne("What We Don't Collect","We do not collect database credentials, database contents, query results, personal information, full source code, or authentication tokens, or any other personal information. Please report any issues with this to the github repository.","section"),new ne("Data Processing","Query Execution: All database execution happens between your browser and remote service. Query results never pass through our servers.","section"),new ne("Security Measures","Any saved local credentials will be encrypted in storage using a passphrase or Chrome credential storage. See Stored Info for more details.","section"),new ne("Children's Privacy","Trilogy Studio is intended for adult data professionals.","section"),new ne("International Data","Telemetry data may cross borders. SQL compilation happens in the US with default query service (fly.io).","section"),new ne("Changes to Privacy Policy","We may update this policy to reflect new features or services, changed functionality, legal requirements, and security improvements.","section"),new ne("Google Account","Trilogy Studio uses Google OAuth to authenticate users when using a Google Bigquery Oauth connection. Trilogy Studio uses a token provided by Google to authenticate your account. Trilogy Studio only requests scopes required for Bigquery read/write access, and the token never leaves your browser. It is used to communicate directly with Bigquery with the google javascript client library."),new ne("Contact Information","For privacy-related questions: please post on the github repository <a href='https://github.com/trilogy-data/trilogy-studio-core'>here</a>.","section"),new ne("Legal Rights","You retain all legal rights regarding your personal data, your source code, your database contents, and generated outputs.","section"),new ne("Effective Date","This policy is effective as of February 22, 2025.","conclusion")]),new cr("Stored Info",[new ne("Local Data","Trilogy Studio uses browser local storage for your editors and models. These do not leave your browser (except when a model is sent in to generate a query)."),new ne("Secret Storage","For databases and LLM connections that require credentials (password, API Key) to access, Trilogy Studio can optionally also store them locally for reuse. [They will never be sent to a remote server]. It will attempt to use secure browser credential storage but will fall back to storing the secret in local browser storage encrypted with a pass phrase if the browser APIs are not available. Be careful storing credentials and be prepared to rotate - consider using a password manager."),new ne("Secret Storage","Local storage is convenient, but if you have a browser secret manager, that is a great place to store secrets as well!","tip"),new ne("Secret Storage","A best practice is to use unique API tokens (such as for LLMs) and passwords in the studio, both to easily track usage and make rotation simple.","tip")]),new cr("Google",[new ne("Google Account","Trilogy Studio uses Google OAuth to authenticate users when using a Google Bigquery connection. Trilogy Studio uses a token provided by Google to authenticate your account through the interactive sign-in flow. Trilogy Studio only requests scopes required for Bigquery read/write access, and the token never leaves your browser. This token is only used to communicate directly with BigQuery with the standard google javascript client library.")]),new cr("Snowflake",[new ne("Google Account","Trilogy Studio supports private key authentication for Snowflake. You will need to provide the private key to connect after configuring your user with the public key portion in Snowflake directly. The rest of the authentication header can be derived from this.")]),new cr("Telemetry Details",[new ne("Telemetry",`<a href="https://www.goatcounter.com/">GoatCounter</a> is used to collect anonymized
2904
- statistics about usage in the studio, such as feature usage. No uniquely identifying information is collected, though the system type, browser, screensize and country are recorded. You can disable telemetry in the settings menu.`)])]),OQn],PQn=h.defineComponent({name:"ResultsView",components:{LoadingView:BS,ResultsContainer:yve,HintComponent:U8e,LLMEditorRefinement:lUn},props:{editorData:{type:Object,required:!0},containerHeight:{type:Number,default:0},canOpenChat:{type:Boolean,default:!1},runEditorQuery:{type:Function,default:void 0}},emits:["llm-query-accepted","drilldown-click","refresh-click","content-change","open-chat"],setup(){const n=h.inject("connectionStore");if(!n)throw new Error("Requires injection of connection store");const e=h.ref(null),t=h.ref(null),i=h.ref(.5),s=h.ref(!1);return{connectionStore:n,splitViewRef:e,resultsContainerRef:t,splitRatio:i,isDragging:s,minPaneWidth:200}},computed:{hasActiveChat(){return this.editorData.hasActiveRefinement()},hasResults(){return this.editorData.results.headers&&this.editorData.results.headers.size>0||!!this.editorData.error},resultsPaneWidth(){return`calc(${this.splitRatio*100}% - 4px)`},chatPaneWidth(){return`calc(${(1-this.splitRatio)*100}% - 4px)`}},methods:{handleAccept(n){this.$emit("llm-query-accepted")},handleDiscard(){},handleContentChange(n,e){this.editorData.setContent(n),this.$emit("content-change",n)},handleChartConfigChange(n){var e;this.editorData.setChartConfig(n),(e=this.resultsContainerRef)==null||e.switchToVisualizeTab()},handleDrilldown(n){this.$emit("drilldown-click",n)},handleOpenChat(){this.$emit("open-chat")},async handleRunEditorQuery(){if(!this.runEditorQuery)return{success:!1,error:"Run editor query is not available"};const n=await this.runEditorQuery();if(!n)return{success:!1,error:"Query execution returned no result"};const e=n.results?[...n.results.headers.keys()].map(t=>String(t)):[];return{success:n.success,results:n.results?{headers:e,data:n.results.data}:void 0,error:n.error,executionTime:n.executionTime,resultSize:n.resultSize,columnCount:n.columnCount,generatedSql:n.generatedSql}},startDragging(n){n.preventDefault(),this.isDragging=!0,document.addEventListener("mousemove",this.onDrag),document.addEventListener("mouseup",this.stopDragging),document.body.style.cursor="col-resize",document.body.style.userSelect="none"},onDrag(n){if(!this.isDragging||!this.splitViewRef)return;const t=this.splitViewRef.getBoundingClientRect(),i=t.width;let r=(n.clientX-t.left)/i;const o=this.minPaneWidth/i,a=1-o;r=Math.max(o,Math.min(a,r)),this.splitRatio=r},stopDragging(){this.isDragging=!1,document.removeEventListener("mousemove",this.onDrag),document.removeEventListener("mouseup",this.stopDragging),document.body.style.cursor="",document.body.style.userSelect=""}},beforeUnmount(){document.removeEventListener("mousemove",this.onDrag),document.removeEventListener("mouseup",this.stopDragging)}}),VQn={class:"results-view"},UQn={key:0,class:"split-view",ref:"splitViewRef"};function HQn(n,e,t,i,s,r){const o=h.resolveComponent("loading-view"),a=h.resolveComponent("results-container"),l=h.resolveComponent("hint-component"),c=h.resolveComponent("LLMEditorRefinement");return h.openBlock(),h.createElementBlock("div",VQn,[n.hasActiveChat?(h.openBlock(),h.createElementBlock("div",UQn,[h.createElementVNode("div",{class:"results-pane",style:h.normalizeStyle({width:n.resultsPaneWidth})},[n.editorData.loading?(h.openBlock(),h.createBlock(o,{key:0,startTime:n.editorData.startTime,cancel:n.editorData.cancelCallback},null,8,["startTime","cancel"])):n.hasResults?(h.openBlock(),h.createBlock(a,{key:1,ref:"resultsContainerRef",results:n.editorData.results,generatedSql:n.editorData.generated_sql||void 0,trilogySource:n.editorData.executed_contents||void 0,containerHeight:n.containerHeight,type:n.editorData.type,chartConfig:n.editorData.chartConfig,error:n.editorData.error||void 0,symbols:n.editorData.completionSymbols,showChatButton:!1,onConfigChange:e[0]||(e[0]=d=>n.editorData.setChartConfig(d)),onDrilldownClick:n.handleDrilldown,onRefreshClick:e[1]||(e[1]=()=>n.$emit("refresh-click"))},null,8,["results","generatedSql","trilogySource","containerHeight","type","chartConfig","error","symbols","onDrilldownClick"])):(h.openBlock(),h.createBlock(l,{key:2}))],4),h.createElementVNode("div",{class:"divider",onMousedown:e[2]||(e[2]=(...d)=>n.startDragging&&n.startDragging(...d))},[...e[5]||(e[5]=[h.createElementVNode("div",{class:"divider-handle"},null,-1)])],32),h.createElementVNode("div",{class:"chat-pane",style:h.normalizeStyle({width:n.chatPaneWidth})},[h.createVNode(c,{editorId:n.editorData.id,runEditorQuery:n.handleRunEditorQuery,onAccept:n.handleAccept,onDiscard:n.handleDiscard,onContentChange:n.handleContentChange,onChartConfigChange:n.handleChartConfigChange},null,8,["editorId","runEditorQuery","onAccept","onDiscard","onContentChange","onChartConfigChange"])],4)],512)):(h.openBlock(),h.createElementBlock(h.Fragment,{key:1},[n.editorData.loading?(h.openBlock(),h.createBlock(o,{key:0,startTime:n.editorData.startTime,cancel:n.editorData.cancelCallback},null,8,["startTime","cancel"])):n.hasResults?(h.openBlock(),h.createBlock(a,{key:1,results:n.editorData.results,generatedSql:n.editorData.generated_sql||void 0,trilogySource:n.editorData.executed_contents||void 0,containerHeight:n.containerHeight,type:n.editorData.type,chartConfig:n.editorData.chartConfig,error:n.editorData.error||void 0,symbols:n.editorData.completionSymbols,showChatButton:n.canOpenChat,onConfigChange:e[3]||(e[3]=d=>n.editorData.setChartConfig(d)),onDrilldownClick:n.handleDrilldown,onRefreshClick:e[4]||(e[4]=()=>n.$emit("refresh-click")),onOpenChat:n.handleOpenChat},null,8,["results","generatedSql","trilogySource","containerHeight","type","chartConfig","error","symbols","showChatButton","onDrilldownClick","onOpenChat"])):(h.openBlock(),h.createBlock(l,{key:2}))],64))])}const R1e=tt(PQn,[["render",HQn],["__scopeId","data-v-0dbf2ac6"]]),olt=Object.freeze(Object.defineProperty({__proto__:null,default:R1e},Symbol.toStringTag,{value:"Module"})),$Qn=h.defineComponent({name:"LLMProviderIcon",props:{providerType:{type:String,required:!0}}}),WQn={class:"provider-icon-container"},zQn={key:0,class:"mdi mdi-alpha-c-circle",title:"Anthropic"},QQn={key:1,class:"mdi mdi-flash",title:"OpenAI"},qQn={key:2,class:"mdi mdi-google",title:"Google"},KQn={key:3,class:"mdi mdi-robot",title:"LLM Provider"};function jQn(n,e,t,i,s,r){return h.openBlock(),h.createElementBlock("div",WQn,[n.providerType==="anthropic"?(h.openBlock(),h.createElementBlock("i",zQn)):n.providerType==="openai"?(h.openBlock(),h.createElementBlock("i",QQn)):n.providerType==="google"?(h.openBlock(),h.createElementBlock("i",qQn)):(h.openBlock(),h.createElementBlock("i",KQn))])}const GQn=tt($Qn,[["render",jQn],["__scopeId","data-v-e96cf50b"]]),YQn=h.defineComponent({name:"ContextMenu",props:{items:{type:Array,required:!0},position:{type:Object,default:()=>({x:0,y:0})},isVisible:{type:Boolean,default:!1},id:{type:String,default:""}},emits:["item-click","close"],setup(n,{emit:e}){const t=h.computed(()=>({left:`${n.position.x}px`,top:`${n.position.y}px`})),i=r=>{e("item-click",r),e("close")},s=r=>{n.isVisible&&e("close")};return h.onMounted(()=>{setTimeout(()=>{document.addEventListener("click",s)},300)}),h.onUnmounted(()=>{document.removeEventListener("click",s)}),{positionStyle:t,handleItemClick:i}}}),XQn=["onClick"];function ZQn(n,e,t,i,s,r){return n.isVisible?(h.openBlock(),h.createElementBlock("div",{key:0,style:h.normalizeStyle(n.positionStyle),class:"context-menu"},[(h.openBlock(!0),h.createElementBlock(h.Fragment,null,h.renderList(n.items,o=>(h.openBlock(),h.createElementBlock("div",{key:o.id,class:h.normalizeClass(["context-menu-item",{danger:o.danger}]),onClick:a=>n.handleItemClick(o)},[o.icon?(h.openBlock(),h.createElementBlock("i",{key:0,class:h.normalizeClass(`mdi ${o.icon}`)},null,2)):h.createCommentVNode("",!0),h.createElementVNode("span",null,h.toDisplayString(o.label),1)],10,XQn))),128))],4)):h.createCommentVNode("",!0)}const JQn=tt(YQn,[["render",ZQn],["__scopeId","data-v-48938153"]]),eqn=h.defineComponent({name:"LLMConnectionListItem",components:{SidebarItem:NS,LLMProviderIcon:GQn,ConnectionRefresh:slt,ConnectionStatusIcon:dge,LoadingButton:ya,ContextMenu:JQn,Tooltip:ko},props:{item:{type:Object,required:!0},isCollapsed:{type:Boolean,default:!0},isSelected:{type:Boolean,default:!1}},emits:["toggle","setActive","refresh","updateApiKey","updateModel","updateFastModel","toggleSaveCredential","deleteConnection","deleteChat"],setup(n,{emit:e}){const t=h.ref(""),i=h.ref(!1),s=h.ref(""),r=h.ref("");h.onMounted(()=>{var I,D,N;n.item.type==="api-key"&&((I=n.item.connection)!=null&&I.getApiKey())&&(t.value=n.item.connection.getApiKey()),n.item.type==="model"&&((D=n.item.connection)!=null&&D.model)&&(s.value=n.item.connection.model),n.item.type==="fast-model"&&(r.value=((N=n.item.connection)==null?void 0:N.fastModel)||"")}),h.watch(()=>{var I;return(I=n.item.connection)==null?void 0:I.apiKey},I=>{n.item.type==="api-key"&&I&&(t.value=I)}),h.watch(()=>{var I;return(I=n.item.connection)==null?void 0:I.model},I=>{n.item.type==="model"&&I&&(s.value=I)},{immediate:!0}),h.watch(()=>{var I;return(I=n.item.connection)==null?void 0:I.fastModel},I=>{n.item.type==="fast-model"&&(r.value=I||"")},{immediate:!0});const o=h.ref(!1),a=h.ref({x:0,y:0}),l=h.computed(()=>{const I=[];return n.item.type==="connection"&&I.push({id:"set-default",label:"Set as Default",icon:"mdi-star-outline"},{id:"refresh",label:"Refresh Connection",icon:"mdi-refresh"},{id:"delete",label:"Delete Connection",icon:"mdi-delete-outline",danger:!0}),I}),c=I=>{n.item.type==="connection"&&(a.value={x:I.clientX,y:I.clientY},o.value=!0)},d=I=>{var D;switch(I.id){case"delete":w(n.item.id);break;case"set-default":_(n.item.id);break;case"refresh":e("refresh",n.item.id,((D=n.item.connection)==null?void 0:D.name)||"","connection");break}},u=h.computed(()=>["connection"].includes(n.item.type)),f=()=>["api-key","model","fast-model","toggle-save-credential","refresh-connection"].includes(n.item.type)?"":n.item.name,g=()=>{(u.value||n.item.type==="open-chat"||n.item.type==="open-validation"||n.item.type==="new-chat"||n.item.type==="chat-item")&&p(n.item.id)},p=I=>{var N;const D=n.item.type==="chat-item"?{chatId:n.item.chatId}:void 0;e("toggle",I,((N=n.item.connection)==null?void 0:N.name)||"",n.item.type,D)},m=I=>{var D;I.stopPropagation(),e("refresh",n.item.id,((D=n.item.connection)==null?void 0:D.name)||"","connection")},A=I=>{e("toggleSaveCredential",I)},b=I=>I instanceof Rv?"anthropic":I instanceof ew?"openai":I instanceof Mv?"google":"unknown",y=I=>I&&I.connected===!0,_=I=>{var D;e("setActive",I,((D=n.item.connection)==null?void 0:D.name)||"","connection")},w=I=>{var D;e("deleteConnection",I,((D=n.item.connection)==null?void 0:D.name)||"")};return{apiKeyInput:t,selectedModel:s,selectedFastModel:r,isExpandable:u,getItemName:f,handleItemClick:g,handleRefreshConnectionClick:m,getProviderType:b,isConnected:y,setAsActive:_,updateApiKey:(I,D)=>{e("updateApiKey",I,D)},updateModel:(I,D)=>{e("updateModel",I,D)},updateFastModel:(I,D)=>{e("updateFastModel",I,D)},toggleSaveCredential:A,deleteConnection:w,deleteChat:I=>{var D;I&&e("deleteChat",I,((D=n.item.connection)==null?void 0:D.name)||"")},contextMenuVisible:o,contextMenuPosition:a,contextMenuItems:l,showContextMenu:c,handleContextMenuItemClick:d,toggleCollapse:p,showApiKey:i,toggleApiKeyVisibility:()=>{i.value=!i.value}}}}),tqn={key:1,class:"mdi mdi-alert-circle node-icon"},nqn={key:2,class:"mdi mdi-chat-outline node-icon"},iqn={key:3,class:"mdi mdi-test-tube node-icon"},sqn={key:4,class:"mdi mdi-chat-plus-outline node-icon"},rqn={key:5,class:"mdi mdi-chat node-icon"},oqn={key:6,class:"mdi mdi-folder-outline node-icon"},aqn={class:"api-key-input-wrapper"},lqn=["type","data-testid"],cqn=["data-testid","title"],dqn=["data-testid"],uqn=["data-testid"],hqn=["data-testid"],fqn=["value","data-testid"],gqn=["data-testid"],pqn=["data-testid"],mqn=["data-testid"],Aqn=["value","data-testid"],bqn={class:"save-credential-toggle"},yqn=["checked"],_qn={key:0},wqn={key:0,class:"chat-actions"},Cqn={key:1,class:"connection-actions"},vqn={key:0,class:"mdi mdi-star loading-button is-active"};function Sqn(n,e,t,i,s,r){const o=h.resolveComponent("context-menu"),a=h.resolveComponent("LLMProviderIcon"),l=h.resolveComponent("tooltip"),c=h.resolveComponent("LoadingButton"),d=h.resolveComponent("connection-refresh"),u=h.resolveComponent("connection-status-icon"),f=h.resolveComponent("sidebar-item");return h.openBlock(),h.createElementBlock("div",null,[h.createVNode(f,{"item-id":n.item.id,name:n.getItemName(),indent:n.item.indent,"is-selected":n.isSelected,"is-collapsible":n.isExpandable,"is-collapsed":n.isCollapsed,itemType:"llm-connection",onClick:n.handleItemClick,onToggle:n.toggleCollapse,onContextmenu:h.withModifiers(n.showContextMenu,["prevent"])},{icon:h.withCtx(()=>[n.item.type==="connection"?(h.openBlock(),h.createBlock(a,{key:0,"provider-type":n.getProviderType(n.item.connection)},null,8,["provider-type"])):n.item.type==="error"?(h.openBlock(),h.createElementBlock("i",tqn)):n.item.type==="open-chat"?(h.openBlock(),h.createElementBlock("i",nqn)):n.item.type==="open-validation"?(h.openBlock(),h.createElementBlock("i",iqn)):n.item.type==="new-chat"?(h.openBlock(),h.createElementBlock("i",sqn)):n.item.type==="chat-item"?(h.openBlock(),h.createElementBlock("i",rqn)):n.item.type==="chats-header"?(h.openBlock(),h.createElementBlock("i",oqn)):h.createCommentVNode("",!0)]),name:h.withCtx(()=>[n.item.type==="refresh-connection"?(h.openBlock(),h.createElementBlock("div",{key:0,class:"refresh title-pad-left truncate-text sidebar-sub-item",onClick:e[1]||(e[1]=(...g)=>n.handleRefreshConnectionClick&&n.handleRefreshConnectionClick(...g))},h.toDisplayString(n.item.name),1)):n.item.type==="api-key"?(h.openBlock(),h.createElementBlock("div",{key:1,class:"api-key-container",onClick:e[5]||(e[5]=h.withModifiers(()=>{},["stop"]))},[h.createElementVNode("form",{onSubmit:e[4]||(e[4]=h.withModifiers(g=>n.updateApiKey(n.item.connection,n.apiKeyInput),["prevent"]))},[e[17]||(e[17]=h.createElementVNode("button",{type:"submit",class:"customize-button"},"Update API Key",-1)),h.createElementVNode("div",aqn,[h.withDirectives(h.createElementVNode("input",{type:n.showApiKey?"text":"password",id:"api-key","onUpdate:modelValue":e[2]||(e[2]=g=>n.apiKeyInput=g),placeholder:"API Key",class:"connection-customize","data-testid":`api-key-input-${n.item.connection.name}`},null,8,lqn),[[h.vModelDynamic,n.apiKeyInput]]),h.createElementVNode("button",{type:"button",class:"visibility-toggle",onClick:e[3]||(e[3]=(...g)=>n.toggleApiKeyVisibility&&n.toggleApiKeyVisibility(...g)),"data-testid":`toggle-api-key-visibility-${n.item.connection.name}`,title:n.showApiKey?"Hide API Key":"Show API Key"},[h.createElementVNode("i",{class:h.normalizeClass(n.showApiKey?"mdi mdi-eye-off":"mdi mdi-eye")},null,2)],8,cqn)])],32)])):n.item.type==="model"?(h.openBlock(),h.createElementBlock("div",{key:2,class:"api-key-container",onClick:e[8]||(e[8]=h.withModifiers(()=>{},["stop"]))},[h.createElementVNode("form",{onSubmit:e[7]||(e[7]=h.withModifiers(g=>n.updateModel(n.item.connection,n.selectedModel),["prevent"])),"data-testid":`model-update-form-${n.item.connection.name}`},[h.createElementVNode("button",{type:"submit",class:"customize-button","data-testid":`update-model-${n.item.connection.name}`}," Update Model ",8,uqn),h.withDirectives(h.createElementVNode("select",{"onUpdate:modelValue":e[6]||(e[6]=g=>n.selectedModel=g),id:"connection-type",required:"",class:"connection-customize","data-testid":`model-select-${n.item.connection.name}`},[(h.openBlock(!0),h.createElementBlock(h.Fragment,null,h.renderList(n.item.connection.models,g=>(h.openBlock(),h.createElementBlock("option",{value:g,key:g,"data-testid":`model-option-${g}`},h.toDisplayString(g),9,fqn))),128))],8,hqn),[[h.vModelSelect,n.selectedModel]])],40,dqn)])):n.item.type==="fast-model"?(h.openBlock(),h.createElementBlock("div",{key:3,class:"api-key-container",onClick:e[11]||(e[11]=h.withModifiers(()=>{},["stop"]))},[h.createElementVNode("form",{onSubmit:e[10]||(e[10]=h.withModifiers(g=>n.updateFastModel(n.item.connection,n.selectedFastModel||null),["prevent"])),"data-testid":`fast-model-update-form-${n.item.connection.name}`},[h.createElementVNode("button",{type:"submit",class:"customize-button","data-testid":`update-fast-model-${n.item.connection.name}`}," Update Fast Model ",8,pqn),h.withDirectives(h.createElementVNode("select",{"onUpdate:modelValue":e[9]||(e[9]=g=>n.selectedFastModel=g),class:"connection-customize","data-testid":`fast-model-select-${n.item.connection.name}`},[e[18]||(e[18]=h.createElementVNode("option",{value:"","data-testid":"fast-model-option-none"},"(Use primary model)",-1)),(h.openBlock(!0),h.createElementBlock(h.Fragment,null,h.renderList(n.item.connection.models,g=>(h.openBlock(),h.createElementBlock("option",{value:g,key:g,"data-testid":`fast-model-option-${g}`},h.toDisplayString(g),9,Aqn))),128))],8,mqn),[[h.vModelSelect,n.selectedFastModel]])],40,gqn)])):n.item.type==="toggle-save-credential"?(h.openBlock(),h.createElementBlock("div",{key:4,class:"md-token-container",onClick:e[13]||(e[13]=h.withModifiers(()=>{},["stop"]))},[h.createElementVNode("label",bqn,[h.createElementVNode("input",{type:"checkbox",checked:n.item.connection.saveCredential,onChange:e[12]||(e[12]=g=>n.toggleSaveCredential(n.item.connection))},null,40,yqn),e[19]||(e[19]=h.createElementVNode("span",{class:"checkbox-label"},"Save Credentials",-1))])])):(h.openBlock(),h.createElementBlock("span",{key:5,class:h.normalizeClass(["title-pad-left truncate-text",{"error-indicator":n.item.type==="error"}])},[h.createTextVNode(h.toDisplayString(n.item.name)+" ",1),n.item.count!==void 0&&n.item.count>0?(h.openBlock(),h.createElementBlock("span",_qn," ("+h.toDisplayString(n.item.count)+") ",1)):h.createCommentVNode("",!0)],2))]),"extra-content":h.withCtx(()=>[n.item.type==="chat-item"?(h.openBlock(),h.createElementBlock("div",wqn,[h.createVNode(l,{class:"tactile-button",content:"Delete Chat",position:"left"},{default:h.withCtx(()=>[h.createElementVNode("span",{class:"remove-btn hover-icon",onClick:e[14]||(e[14]=h.withModifiers(g=>n.deleteChat(n.item.chatId),["stop"]))},[...e[20]||(e[20]=[h.createElementVNode("i",{class:"mdi mdi-trash-can-outline"},null,-1)])])]),_:1})])):h.createCommentVNode("",!0),n.item.type==="connection"?(h.openBlock(),h.createElementBlock("div",Cqn,[n.item.connection&&n.item.connection.isDefault?(h.openBlock(),h.createElementBlock("i",vqn)):(h.openBlock(),h.createBlock(c,{key:1,class:"loading-button",onClick:e[15]||(e[15]=h.withModifiers(()=>{},["stop"])),action:()=>n.setAsActive(n.item.id),title:"Set as default"},{default:h.withCtx(()=>[...e[21]||(e[21]=[h.createElementVNode("i",{class:"mdi mdi-star-outline"},null,-1)])]),_:1},8,["action"])),n.item.connection?(h.openBlock(),h.createBlock(d,{key:2,connection:n.item.connection,type:"llm","is-connected":n.isConnected(n.item.connection),"data-testid":`refresh-llm-connection-${n.item.connection.name}`},null,8,["connection","is-connected","data-testid"])):h.createCommentVNode("",!0),h.createVNode(l,{class:"tacticle-button",content:"Delete Connection",position:"left"},{default:h.withCtx(()=>[h.createElementVNode("span",{class:"remove-btn",onClick:e[16]||(e[16]=h.withModifiers(g=>n.deleteConnection(n.item.id),["stop"]))},[...e[22]||(e[22]=[h.createElementVNode("i",{class:"mdi mdi-trash-can-outline tactile-button"},null,-1)])])]),_:1}),n.item.connection?(h.openBlock(),h.createBlock(u,{key:3,connection:n.item.connection},null,8,["connection"])):h.createCommentVNode("",!0)])):h.createCommentVNode("",!0)]),default:h.withCtx(()=>[h.createVNode(o,{items:n.contextMenuItems,position:n.contextMenuPosition,"is-visible":n.contextMenuVisible,onItemClick:n.handleContextMenuItemClick,onClose:e[0]||(e[0]=g=>n.contextMenuVisible=!1)},null,8,["items","position","is-visible","onItemClick"])]),_:1},8,["item-id","name","indent","is-selected","is-collapsible","is-collapsed","onClick","onToggle","onContextmenu"])])}const Eqn=tt(eqn,[["render",Sqn],["__scopeId","data-v-c4adb9d9"]]),wG={openai:["gpt-5.2","gpt-5.2-mini","gpt-5.1"],anthropic:["claude-opus-4-20250514","claude-sonnet-4-20250514","claude-3-5-sonnet-20240620"],google:["models/gemini-2.5-pro","models/gemini-2.5-flash"]},xqn=h.defineComponent({name:"LLMConnectionCreator",props:{visible:{type:Boolean,required:!0},testTag:{type:String,required:!1,default:""}},methods:{close(){this.$emit("close")}},components:{LoadingButton:ya},setup(n,{emit:e}){const t=h.ref({name:"",type:"openai",options:{apiKey:"",model:ew.getDefaultModel(wG.openai),saveCredential:!1}}),i=h.inject("llmConnectionStore");if(!i)throw new Error("must inject llmConnectionStore to LLMConnectionCreator");const s=i.connections,r=()=>{t.value.name="",t.value.type="openai",t.value.options={apiKey:"",model:"",saveCredential:!1},o("openai")},o=c=>{switch(c){case"openai":t.value.options.model=ew.getDefaultModel(wG.openai);break;case"anthropic":t.value.options.model=Rv.getDefaultModel(wG.anthropic);break;case"google":t.value.options.model=Mv.getDefaultModel(wG.google);break;default:t.value.options.model=""}},a=async()=>{await l()},l=async()=>{if(!t.value.name)throw new Error("Connection name is required");if(!t.value.type)throw new Error("Provider type is required");if(!t.value.options.apiKey)throw new Error("API key is required");return await i.newConnection(t.value.name,t.value.type,t.value.options),e("close"),"Connection created successfully"};return{connectionDetails:t,connections:s,createConnection:r,handleSubmitConnection:l,submitConnectionCreation:a,updateDefaultModel:o}},watch:{"connectionDetails.type":{handler(n){this.updateDefaultModel(n)}}}}),kqn={key:0,class:"creator-container"},Tqn={class:"form-row"},Lqn={class:"form-row"},Iqn={class:"form-row"},Dqn={class:"form-row"},Nqn={class:"button-row"};function Rqn(n,e,t,i,s,r){const o=h.resolveComponent("loading-button");return n.visible?(h.openBlock(),h.createElementBlock("div",kqn,[h.createElementVNode("form",{onSubmit:e[5]||(e[5]=h.withModifiers((...a)=>n.submitConnectionCreation&&n.submitConnectionCreation(...a),["prevent"]))},[h.createElementVNode("div",Tqn,[e[6]||(e[6]=h.createElementVNode("label",{for:"llm-connection-name"},"Name",-1)),h.withDirectives(h.createElementVNode("input",{type:"text","onUpdate:modelValue":e[0]||(e[0]=a=>n.connectionDetails.name=a),id:"llm-connection-name",required:"","data-testid":"llm-connection-creator-name",placeholder:"Connection Name"},null,512),[[h.vModelText,n.connectionDetails.name]])]),h.createElementVNode("div",Lqn,[e[8]||(e[8]=h.createElementVNode("label",{for:"llm-provider-type"},"Provider",-1)),h.withDirectives(h.createElementVNode("select",{"onUpdate:modelValue":e[1]||(e[1]=a=>n.connectionDetails.type=a),id:"llm-provider-type",required:"","data-testid":"llm-connection-creator-type"},[...e[7]||(e[7]=[h.createElementVNode("option",{value:"openai","data-testid":"llm-connection-creator-openai"},"OpenAI",-1),h.createElementVNode("option",{value:"anthropic","data-testid":"llm-connection-creator-anthropic"}," Anthropic ",-1),h.createElementVNode("option",{value:"google","data-testid":"llm-connection-creator-google"},"Google",-1)])],512),[[h.vModelSelect,n.connectionDetails.type]])]),h.createElementVNode("div",Iqn,[e[9]||(e[9]=h.createElementVNode("label",{for:"llm-api-key"},"API Key",-1)),h.withDirectives(h.createElementVNode("input",{type:"password","onUpdate:modelValue":e[2]||(e[2]=a=>n.connectionDetails.options.apiKey=a),id:"llm-api-key",placeholder:"API Key",required:"","data-testid":"llm-connection-creator-api-key"},null,512),[[h.vModelText,n.connectionDetails.options.apiKey]])]),h.createElementVNode("div",Dqn,[e[10]||(e[10]=h.createElementVNode("label",{for:"save-credential"},"Save Credential?",-1)),h.withDirectives(h.createElementVNode("input",{type:"checkbox",id:"save-credential","onUpdate:modelValue":e[3]||(e[3]=a=>n.connectionDetails.options.saveCredential=a),"data-testid":"llm-connection-creator-save-credential"},null,512),[[h.vModelCheckbox,n.connectionDetails.options.saveCredential]])]),h.createElementVNode("div",Nqn,[h.createVNode(o,{"data-testid":"llm-connection-creator-submit",action:n.handleSubmitConnection,class:"submit-button"},{default:h.withCtx(()=>[...e[11]||(e[11]=[h.createTextVNode(" Submit ",-1)])]),_:1},8,["action"]),h.createElementVNode("button",{type:"button",onClick:e[4]||(e[4]=a=>n.close())},"Cancel")])],32)])):h.createCommentVNode("",!0)}const Mqn={name:"LLMConnectionList",props:{activeLLMKey:{type:String,default:"",optional:!0},testTag:{type:String,default:"",optional:!0}},emits:["llm-open-view","create-new-chat","open-chat"],setup(n,{emit:e}){const t=h.inject("llmConnectionStore"),i=h.inject("saveLLMConnections"),s=h.inject("chatStore",null);if(!t||!i)throw new Error("LLM connection store is not provided!");const r=h.ref({}),o=h.ref({}),a=h.ref(!1),l=async(b,y)=>{y&&(await t.connections[b.name].setApiKey(y),t.resetConnection(b.name),await i())},c=(b,y)=>{y&&(t.connections[b.name].setModel(y),t.resetConnection(b.name),i())},d=(b,y)=>{t.connections[b.name].setFastModel(y),i()},u=h.ref({}),f=async(b,y,_)=>{if(!t.connections[y]){o.value[b]="Connection not found";return}try{if(r.value[b]=!0,_==="connection"){const w=t.connections[y];w.testConnection&&await w.testConnection()}delete o.value[b]}catch(w){w instanceof Error?o.value[b]=w.message:o.value[b]="An error occurred"}delete r.value[b]},g=async(b,y,_,w)=>{if(_==="new-chat"){e("create-new-chat",y);return}if(_==="chat-item"){s&&(w!=null&&w.chatId)&&(s.setActiveChat(w.chatId),t.activeConnection=y),e("llm-open-view",y,"chat",w==null?void 0:w.chatId);return}if(_==="open-chat"){e("llm-open-view",y,"chat");return}if(_==="open-validation"){e("llm-open-view",y,"validation");return}if(_==="connection"&&(u.value[b]===void 0||u.value[b]===!0)){const C=t.connections[y];if(!C){console.log(`Connection not found ${C}`);return}(!C.models||C.models.length===0)&&await f(b,y,"models")}u.value[b]===void 0?u.value[b]=!1:u.value[b]=!u.value[b]};Object.entries(t.connections).forEach(([b,y])=>{let _=b;u.value[_]=!0}),h.onMounted(()=>{const b=ai("llm-key","");if(b){const y=b.split($t),_=y[0],w=y[1];_&&t.connections[_]&&(u.value[_]=!1,t.activeConnection=_,w&&s&&s.setActiveChat(w))}});const p=h.computed(()=>{const b=[];return Object.entries(t.connections).sort(([_,w],[C,E])=>{const S=w,x=E;return S.connected&&!x.connected?-1:!S.connected&&x.connected?1:_.localeCompare(C)}).forEach(([_,w])=>{var S;const C=w,E=((S=C.availableModels)==null?void 0:S.length)||0;if(!C.deleted&&(b.push({id:_,name:_,indent:0,count:E,type:"connection",connection:C}),u.value[_]===!1)){const x=s?s.getConnectionChats(_):[];b.push({id:`${_}-new-chat`,name:"New Chat",indent:1,count:x.length,type:"new-chat",connection:C}),x.forEach(k=>{b.push({id:`${_}-chat-${k.id}`,name:k.name,indent:2,count:k.messages.length,type:"chat-item",connection:C,chat:k,chatId:k.id})}),b.push({id:`${_}-open-validation`,name:"Validation Tests",indent:1,count:0,type:"open-validation",connection:C}),b.push({id:`${_}-api-key`,name:"API Key",indent:1,count:0,type:"api-key",connection:C}),b.push({id:`${_}-model`,name:"Model",indent:1,count:0,type:"model",connection:C}),b.push({id:`${_}-fast-model`,name:"Fast Model",indent:1,count:0,type:"fast-model",connection:C}),b.push({id:`${_}-toggle-save-credential`,name:"Toggle Save Credential",indent:1,count:0,type:"toggle-save-credential",connection:C}),r.value[_]&&b.push({id:`${_}-loading`,name:"Loading...",indent:1,count:0,type:"loading",connection:C}),o.value[_]&&b.push({id:`${_}-error`,name:o.value[_],indent:1,count:0,type:"error",connection:C})}}),b});return{llmConnectionStore:t,chatStore:s,contentList:p,toggleCollapse:g,collapsed:u,saveConnections:i,updateApiKey:l,updateModel:c,updateFastModel:d,refreshId:f,rightSplit:b=>{const y=b.lastIndexOf($t);return y!==-1?b.substring(0,y):b},creatorVisible:a,isItemSelected:b=>b.type==="chat-item"&&b.chatId&&s?b.chatId===s.activeChatId:b.type==="connection"?b.id===t.activeConnection:!1}},components:{SidebarList:DS,LLMConnectionListItem:Eqn,LLMConnectionCreator:tt(xqn,[["render",Rqn],["__scopeId","data-v-7e9f9a7b"]]),LoadingButton:ya,StatusIcon:RS,Tooltip:ko},methods:{resetConnection(n){return this.llmConnectionStore.resetConnection(n.name)},setActiveConnection(n){this.llmConnectionStore.activeConnection=n,this.llmConnectionStore.connections[n].isDefault=!0,this.llmConnectionStore.connections[n].changed=!0,Object.keys(this.llmConnectionStore.connections).forEach(e=>{e!==n&&this.llmConnectionStore.connections[e].isDefault&&(this.llmConnectionStore.connections[e].isDefault=!1,this.llmConnectionStore.connections[e].changed=!0)}),this.saveConnections()},deleteConnection(n,e){confirm(`Are you sure you want to delete the connection "${e}"?`)&&(this.llmConnectionStore.connections[e].delete(),this.llmConnectionStore.activeConnection===n&&(this.llmConnectionStore.activeConnection=""))},deleteChat(n,e){confirm("Are you sure you want to delete this chat?")&&this.chatStore&&this.chatStore.removeChat(n)},toggleSaveCredential(n){n.saveCredential=!n.saveCredential,this.saveConnections()}},computed:{connections(){return Object.values(this.llmConnectionStore.connections)}}},Bqn={class:"button-container"},Fqn=["data-testid"];function Oqn(n,e,t,i,s,r){const o=h.resolveComponent("LLMConnectionCreator"),a=h.resolveComponent("LLMConnectionListItem"),l=h.resolveComponent("sidebar-list");return h.openBlock(),h.createBlock(l,{title:"LLM Connections"},{actions:h.withCtx(()=>[h.createElementVNode("div",Bqn,[h.createElementVNode("button",{onClick:e[0]||(e[0]=c=>i.creatorVisible=!i.creatorVisible),"data-testid":t.testTag?`llm-connection-creator-add-${t.testTag}`:"llm-connection-creator-add"},h.toDisplayString(i.creatorVisible?"Hide":"New"),9,Fqn)]),h.createVNode(o,{visible:i.creatorVisible,onClose:e[1]||(e[1]=c=>i.creatorVisible=!i.creatorVisible)},null,8,["visible"])]),default:h.withCtx(()=>[(h.openBlock(!0),h.createElementBlock(h.Fragment,null,h.renderList(i.contentList,c=>(h.openBlock(),h.createBlock(a,{key:c.id,item:c,"is-collapsed":i.collapsed[c.id],isSelected:i.isItemSelected(c),onToggle:i.toggleCollapse,onRefresh:i.refreshId,onUpdateApiKey:i.updateApiKey,onUpdateModel:i.updateModel,onUpdateFastModel:i.updateFastModel,onSetActive:r.setActiveConnection,onDeleteConnection:r.deleteConnection,onDeleteChat:r.deleteChat,onToggleSaveCredential:r.toggleSaveCredential},null,8,["item","is-collapsed","isSelected","onToggle","onRefresh","onUpdateApiKey","onUpdateModel","onUpdateFastModel","onSetActive","onDeleteConnection","onDeleteChat","onToggleSaveCredential"]))),128))]),_:1})}const alt=tt(Mqn,[["render",Oqn],["__scopeId","data-v-6e87d854"]]);var Pqn=Object.defineProperty,Vqn=(n,e,t)=>e in n?Pqn(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,at=(n,e,t)=>(Vqn(n,typeof e!="symbol"?e+"":e,t),t);function Uqn(n){let e=0,t;for(let i=0,s=n.length;i<s;i++)t=n[i].y+n[i].h,t>e&&(e=t);return e}function M1e(n){const e=Array(n.length);for(let t=0,i=n.length;t<i;t++)e[t]=Hqn(n[t]);return e}function Hqn(n){return JSON.parse(JSON.stringify(n))}function llt(n,e){return!(n===e||n.x+n.w<=e.x||n.x>=e.x+e.w||n.y+n.h<=e.y||n.y>=e.y+e.h)}function sR(n,e,t){const i=ult(n),s=flt(n),r=Array(n.length);for(let o=0,a=s.length;o<a;o++){let l=s[o];l.static||(l=$qn(i,l,e,t),i.push(l)),r[n.indexOf(l)]=l,l.moved=!1}return r}function $qn(n,e,t,i){if(t)for(;e.y>0&&!J3(n,e);)e.y--;else if(i){const r=i[e.i].y;for(;e.y>r&&!J3(n,e);)e.y--}let s;for(;s=J3(n,e);)e.y=s.y+s.h;return e}function Wqn(n,e){const t=ult(n);for(let i=0,s=n.length;i<s;i++){const r=n[i];if(r.x+r.w>e.cols&&(r.x=e.cols-r.w),r.x<0&&(r.x=0,r.w=e.cols),!r.static)t.push(r);else for(;J3(t,r);)r.y++}return n}function clt(n,e){for(let t=0,i=n.length;t<i;t++)if(n[t].i===e)return n[t]}function J3(n,e){for(let t=0,i=n.length;t<i;t++)if(llt(n[t],e))return n[t]}function dlt(n,e){return n.filter(t=>llt(t,e))}function ult(n){return n.filter(e=>e.static)}function B1e(n,e,t,i,s,r){if(e.static)return n;const o=e.x,a=e.y,l=i&&e.y>i;typeof t=="number"&&(e.x=t),typeof i=="number"&&(e.y=i),e.moved=!0;let c=flt(n);l&&(c=c.reverse());const d=dlt(c,e);if(r&&d.length)return e.x=o,e.y=a,e.moved=!1,n;for(let u=0,f=d.length;u<f;u++){const g=d[u];g.moved||e.y>g.y&&e.y-g.y>g.h/4||(g.static?n=hlt(n,g,e,s):n=hlt(n,e,g,s))}return n}function hlt(n,e,t,i){if(i){const s={x:t.x,y:t.y,w:t.w,h:t.h};if(s.y=Math.max(e.y-t.h,0),!J3(n,s))return B1e(n,t,void 0,s.y,!1)}return B1e(n,t,void 0,t.y+1,!1)}function zqn(n,e,t,i){const s="translate3d("+e+"px,"+n+"px, 0)";return{transform:s,WebkitTransform:s,MozTransform:s,msTransform:s,OTransform:s,width:t+"px",height:i+"px",position:"absolute"}}function Qqn(n,e,t,i){const s="translate3d("+e*-1+"px,"+n+"px, 0)";return{transform:s,WebkitTransform:s,MozTransform:s,msTransform:s,OTransform:s,width:t+"px",height:i+"px",position:"absolute"}}function qqn(n,e,t,i){return{top:n+"px",left:e+"px",width:t+"px",height:i+"px",position:"absolute"}}function Kqn(n,e,t,i){return{top:n+"px",right:e+"px",width:t+"px",height:i+"px",position:"absolute"}}function flt(n){return[].concat(n).sort(function(e,t){return e.y===t.y&&e.x===t.x?0:e.y>t.y||e.y===t.y&&e.x>t.x?1:-1})}function jqn(n,e){e=e||"Layout";const t=["x","y","w","h"],i=[];if(!Array.isArray(n))throw new Error(e+" must be an array!");for(let s=0,r=n.length;s<r;s++){const o=n[s];for(let a=0;a<t.length;a++)if(typeof o[t[a]]!="number")throw new Error("VueGridLayout: "+e+"["+s+"]."+t[a]+" must be a number!");if(o.i===void 0||o.i===null)throw new Error("VueGridLayout: "+e+"["+s+"].i cannot be null!");if(typeof o.i!="number"&&typeof o.i!="string")throw new Error("VueGridLayout: "+e+"["+s+"].i must be a string or number!");if(i.indexOf(o.i)>=0)throw new Error("VueGridLayout: "+e+"["+s+"].i must be unique!");if(i.push(o.i),o.static!==void 0&&typeof o.static!="boolean")throw new Error("VueGridLayout: "+e+"["+s+"].static must be a boolean!")}}function glt(n){return Gqn(n)}function Gqn(n){const e=n.target,t=e.offsetParent||document.body,i=e.offsetParent===document.body?{left:0,top:0}:t.getBoundingClientRect(),s=n.clientX+t.scrollLeft-i.left,r=n.clientY+t.scrollTop-i.top;return{x:s,y:r}}function plt(n,e,t,i){return Yqn(n)?{deltaX:t-n,deltaY:i-e,lastX:n,lastY:e,x:t,y:i}:{deltaX:0,deltaY:0,lastX:t,lastY:i,x:t,y:i}}function Yqn(n){return typeof n=="number"&&!isNaN(n)}function Xqn(n,e){const t=mlt(n);let i=t[0];for(let s=1,r=t.length;s<r;s++){const o=t[s];e>n[o]&&(i=o)}return i}function F1e(n,e){if(!e[n])throw new Error("ResponsiveGridLayout: `cols` entry for breakpoint "+n+" is missing!");return e[n]}function Zqn(n,e,t,i,s,r,o){if(e[i])return M1e(e[i]);let a=n;const l=mlt(t),c=l.slice(l.indexOf(i));for(let d=0,u=c.length;d<u;d++){const f=c[d];if(e[f]){a=e[f];break}}return a=M1e(a||[]),sR(Wqn(a,{cols:r}),o)}function mlt(n){return Object.keys(n).sort(function(e,t){return n[e]-n[t]})}let Jqn="auto";function eKn(){return typeof document<"u"}function Alt(){return typeof window<"u"}function blt(){return eKn()?typeof document.dir<"u"?document.dir:document.getElementsByTagName("html")[0].getAttribute("dir")||"auto":Jqn}function tKn(n,e){return Alt?(window.addEventListener(n,e),!0):(e(),!1)}function nKn(n,e){!Alt||window.removeEventListener(n,e)}const Wf={init:iKn,document:null,DocumentFragment:null,SVGElement:null,SVGSVGElement:null,SVGElementInstance:null,Element:null,HTMLElement:null,Event:null,Touch:null,PointerEvent:null};function rR(){}const Uu=Wf;function iKn(n){const e=n;Wf.document=e.document,Wf.DocumentFragment=e.DocumentFragment||rR,Wf.SVGElement=e.SVGElement||rR,Wf.SVGSVGElement=e.SVGSVGElement||rR,Wf.SVGElementInstance=e.SVGElementInstance||rR,Wf.Element=e.Element||rR,Wf.HTMLElement=e.HTMLElement||Wf.Element,Wf.Event=e.Event,Wf.Touch=e.Touch||rR,Wf.PointerEvent=e.PointerEvent||e.MSPointerEvent}const ylt=n=>!!(n&&n.Window)&&n instanceof n.Window;let _lt,L0;function wlt(n){_lt=n;const e=n.document.createTextNode("");e.ownerDocument!==n.document&&typeof n.wrap=="function"&&n.wrap(e)===e&&(n=n.wrap(n)),L0=n}typeof window<"u"&&window&&wlt(window);function rx(n){return ylt(n)?n:(n.ownerDocument||n).defaultView||L0.window}const sKn=n=>n===L0||ylt(n),rKn=n=>CG(n)&&n.nodeType===11,CG=n=>!!n&&typeof n=="object",Clt=n=>typeof n=="function",oKn=n=>typeof n=="number",aKn=n=>typeof n=="boolean",lKn=n=>typeof n=="string",cKn=n=>{if(!n||typeof n!="object")return!1;const e=rx(n)||L0;return/object|function/.test(typeof Element)?n instanceof Element||n instanceof e.Element:n.nodeType===1&&typeof n.nodeName=="string"},dKn=n=>CG(n)&&!!n.constructor&&/function Object\b/.test(n.constructor.toString()),uKn=n=>CG(n)&&typeof n.length<"u"&&Clt(n.splice),ut={window:sKn,docFrag:rKn,object:CG,func:Clt,number:oKn,bool:aKn,string:lKn,element:cKn,plainObject:dKn,array:uKn},zf={init:hKn,supportsTouch:null,supportsPointerEvent:null,isIOS7:null,isIOS:null,isIe9:null,isOperaMobile:null,prefixedMatchesSelector:null,pEventTypes:null,wheelEvent:null};function hKn(n){const e=Uu.Element,t=n.navigator||{};zf.supportsTouch="ontouchstart"in n||ut.func(n.DocumentTouch)&&Uu.document instanceof n.DocumentTouch,zf.supportsPointerEvent=t.pointerEnabled!==!1&&!!Uu.PointerEvent,zf.isIOS=/iP(hone|od|ad)/.test(t.platform),zf.isIOS7=/iP(hone|od|ad)/.test(t.platform)&&/OS 7[^\d]/.test(t.appVersion),zf.isIe9=/MSIE 9/.test(t.userAgent),zf.isOperaMobile=t.appName==="Opera"&&zf.supportsTouch&&/Presto/.test(t.userAgent),zf.prefixedMatchesSelector="matches"in e.prototype?"matches":"webkitMatchesSelector"in e.prototype?"webkitMatchesSelector":"mozMatchesSelector"in e.prototype?"mozMatchesSelector":"oMatchesSelector"in e.prototype?"oMatchesSelector":"msMatchesSelector",zf.pEventTypes=zf.supportsPointerEvent?Uu.PointerEvent===n.MSPointerEvent?{up:"MSPointerUp",down:"MSPointerDown",over:"mouseover",out:"mouseout",move:"MSPointerMove",cancel:"MSPointerCancel"}:{up:"pointerup",down:"pointerdown",over:"pointerover",out:"pointerout",move:"pointermove",cancel:"pointercancel"}:null,zf.wheelEvent=Uu.document&&"onmousewheel"in Uu.document?"mousewheel":"wheel"}const Bp=zf;function ox(n,e){if(n.contains)return n.contains(e);for(;e;){if(e===n)return!0;e=e.parentNode}return!1}function vlt(n,e){for(;ut.element(n);){if(ax(n,e))return n;n=I0(n)}return null}function I0(n){let e=n.parentNode;if(ut.docFrag(e)){for(;(e=e.host)&&ut.docFrag(e););return e}return e}function ax(n,e){return L0!==_lt&&(e=e.replace(/\/deep\//g," ")),n[Bp.prefixedMatchesSelector](e)}function O1e(n,e,t){for(;ut.element(n);){if(ax(n,e))return!0;if(n=I0(n),n===t)return ax(n,e)}return!1}function Slt(n){return n.correspondingUseElement||n}function fKn(n){return n=n||L0,{x:n.scrollX||n.document.documentElement.scrollLeft,y:n.scrollY||n.document.documentElement.scrollTop}}function P1e(n){const e=n instanceof Uu.SVGElement?n.getBoundingClientRect():n.getClientRects()[0];return e&&{left:e.left,right:e.right,top:e.top,bottom:e.bottom,width:e.width||e.right-e.left,height:e.height||e.bottom-e.top}}function V1e(n){const e=P1e(n);if(!Bp.isIOS7&&e){const t=fKn(rx(n));e.left+=t.x,e.right+=t.x,e.top+=t.y,e.bottom+=t.y}return e}function Elt(n){return ut.string(n)?(Uu.document.querySelector(n),!0):!1}function In(n,e){for(const t in e)n[t]=e[t];return n}function eV(n,e){let t=!1;return function(){return t||(L0.console.warn(e),t=!0),n.apply(this,arguments)}}function xlt(n,e){return n.name=e.name,n.axis=e.axis,n.edges=e.edges,n}function gKn(n){const{Interactable:e}=n;e.prototype.getAction=function(t,i,s,r){const o=pKn(this,i,s,r,n);return this.options.actionChecker?this.options.actionChecker(t,i,o,this,r,s):o},e.prototype.ignoreFrom=eV(function(t){return this._backCompatOption("ignoreFrom",t)},"Interactable.ignoreFrom() has been deprecated. Use Interactble.draggable({ignoreFrom: newValue})."),e.prototype.allowFrom=eV(function(t){return this._backCompatOption("allowFrom",t)},"Interactable.allowFrom() has been deprecated. Use Interactble.draggable({allowFrom: newValue})."),e.prototype.actionChecker=AKn,e.prototype.styleCursor=mKn}function pKn(n,e,t,i,s){const r=n.getRect(i),o=e.buttons||{0:1,1:4,3:8,4:16}[e.button],a={action:null,interactable:n,interaction:t,element:i,rect:r,buttons:o};return s.fire("auto-start:check",a),a.action}function mKn(n){return ut.bool(n)?(this.options.styleCursor=n,this):n===null?(delete this.options.styleCursor,this):this.options.styleCursor}function AKn(n){return ut.func(n)?(this.options.actionChecker=n,this):n===null?(delete this.options.actionChecker,this):this.options.actionChecker}const bKn={id:"auto-start/interactableMethods",install:gKn};function yKn(n){const{interactStatic:e,defaults:t}=n;n.usePlugin(bKn),t.base.actionChecker=null,t.base.styleCursor=!0,In(t.perAction,{manualStart:!1,max:1/0,maxPerElement:1,allowFrom:null,ignoreFrom:null,mouseButtons:1}),e.maxInteractions=i=>Ilt(i,n),n.autoStart={maxInteractions:1/0,withinInteractionLimit:vG,cursorElement:null}}function _Kn({interaction:n,pointer:e,event:t,eventTarget:i},s){if(n.interacting())return;const r=Tlt(n,e,t,i,s);Llt(n,r,s)}function wKn({interaction:n,pointer:e,event:t,eventTarget:i},s){if(n.pointerType!=="mouse"||n.pointerIsDown||n.interacting())return;const r=Tlt(n,e,t,i,s);Llt(n,r,s)}function CKn(n,e){const{interaction:t}=n;if(!t.pointerIsDown||t.interacting()||!t.pointerWasMoved||!t.prepared.name)return;e.fire("autoStart:before-start",n);const{interactable:i}=t,s=t.prepared.name;s&&i&&(i.options[s].manualStart||!vG(i,t.element,t.prepared,e)?t.stop():(t.start(t.prepared,i,t.element),Dlt(t,e)))}function vKn({interaction:n},e){const{interactable:t}=n;t&&t.options.styleCursor&&U1e(n.element,"",e)}function klt(n,e,t,i,s){return e.testIgnoreAllow(e.options[n.name],t,i)&&e.options[n.name].enabled&&vG(e,t,n,s)?n:null}function SKn(n,e,t,i,s,r,o){for(let a=0,l=i.length;a<l;a++){const c=i[a],d=s[a],u=c.getAction(e,t,n,d);if(!u)continue;const f=klt(u,c,d,r,o);if(f)return{action:f,interactable:c,element:d}}return{action:null,interactable:null,element:null}}function Tlt(n,e,t,i,s){let r=[],o=[],a=i;function l(c){r.push(c),o.push(a)}for(;ut.element(a);){r=[],o=[],s.interactables.forEachMatch(a,l);const c=SKn(n,e,t,r,o,i,s);if(c.action&&!c.interactable.options[c.action.name].manualStart)return c;a=I0(a)}return{action:null,interactable:null,element:null}}function Llt(n,{action:e,interactable:t,element:i},s){e=e||{name:null},n.interactable=t,n.element=i,xlt(n.prepared,e),n.rect=t&&e.name?t.getRect(i):null,Dlt(n,s),s.fire("autoStart:prepared",{interaction:n})}function vG(n,e,t,i){const s=n.options,r=s[t.name].max,o=s[t.name].maxPerElement,a=i.autoStart.maxInteractions;let l=0,c=0,d=0;if(!(r&&o&&a))return!1;for(const u of i.interactions.list){const f=u.prepared.name;if(u.interacting()&&(l++,l>=a||u.interactable===n&&(c+=f===t.name?1:0,c>=r||u.element===e&&(d++,f===t.name&&d>=o))))return!1}return a>0}function Ilt(n,e){return ut.number(n)?(e.autoStart.maxInteractions=n,this):e.autoStart.maxInteractions}function U1e(n,e,t){const{cursorElement:i}=t.autoStart;i&&i!==n&&(i.style.cursor=""),n.ownerDocument.documentElement.style.cursor=e,n.style.cursor=e,t.autoStart.cursorElement=e?n:null}function Dlt(n,e){const{interactable:t,element:i,prepared:s}=n;if(!(n.pointerType==="mouse"&&t&&t.options.styleCursor)){e.autoStart.cursorElement&&U1e(e.autoStart.cursorElement,"",e);return}let r="";if(s.name){const o=t.options[s.name].cursorChecker;ut.func(o)?r=o(s,t,i,n._interacting):r=e.actions.map[s.name].getCursor(s)}U1e(n.element,r||"",e)}const EKn={id:"auto-start/base",before:["actions"],install:yKn,listeners:{"interactions:down":_Kn,"interactions:move":(n,e)=>{wKn(n,e),CKn(n,e)},"interactions:stop":vKn},maxInteractions:Ilt,withinInteractionLimit:vG,validateAction:klt},H1e=EKn;function xKn({interaction:n,eventTarget:e,dx:t,dy:i},s){if(n.prepared.name!=="drag")return;const r=Math.abs(t),o=Math.abs(i),a=n.interactable.options.drag,l=a.startAxis,c=r>o?"x":r<o?"y":"xy";if(n.prepared.axis=a.lockAxis==="start"?c[0]:a.lockAxis,c!=="xy"&&l!=="xy"&&l!==c){n.prepared.name=null;let d=e;const u=function(f){if(f===n.interactable)return;const g=n.interactable.options.drag;if(!g.manualStart&&f.testIgnoreAllow(g,d,e)){const p=f.getAction(n.downPointer,n.downEvent,n,d);if(p&&p.name==="drag"&&kKn(c,f)&&H1e.validateAction(p,f,d,e,s))return f}};for(;ut.element(d);){const f=s.interactables.forEachMatch(d,u);if(f){n.prepared.name="drag",n.interactable=f,n.element=d;break}d=I0(d)}}}function kKn(n,e){if(!e)return!1;const t=e.options.drag.startAxis;return n==="xy"||t==="xy"||t===n}const TKn={id:"auto-start/dragAxis",listeners:{"autoStart:before-start":xKn}};function LKn(n){const{defaults:e}=n;n.usePlugin(H1e),e.perAction.hold=0,e.perAction.delay=0}function $1e(n){const e=n.prepared&&n.prepared.name;if(!e)return null;const t=n.interactable.options;return t[e].hold||t[e].delay}const IKn={id:"auto-start/hold",install:LKn,listeners:{"interactions:new":({interaction:n})=>{n.autoStartHoldTimer=null},"autoStart:prepared":({interaction:n})=>{const e=$1e(n);e>0&&(n.autoStartHoldTimer=setTimeout(()=>{n.start(n.prepared,n.interactable,n.element)},e))},"interactions:move":({interaction:n,duplicate:e})=>{n.autoStartHoldTimer&&n.pointerWasMoved&&!e&&(clearTimeout(n.autoStartHoldTimer),n.autoStartHoldTimer=null)},"autoStart:before-start":({interaction:n})=>{$1e(n)>0&&(n.prepared.name=null)}},getHoldDuration:$1e},DKn=IKn,NKn={id:"auto-start",install(n){n.usePlugin(H1e),n.usePlugin(DKn),n.usePlugin(TKn)}},RKn=(n,e)=>n.indexOf(e)!==-1,Nlt=(n,e)=>{for(const t of e)n.push(t);return n},Rlt=n=>Nlt([],n),SG=(n,e)=>{for(let t=0;t<n.length;t++)if(e(n[t],t,n))return t;return-1},W1e=(n,e)=>n[SG(n,e)];function oR(n){const e={};for(const t in n){const i=n[t];ut.plainObject(i)?e[t]=oR(i):ut.array(i)?e[t]=Rlt(i):e[t]=i}return e}let Mlt=0,g_,lx;function MKn(n){if(g_=n.requestAnimationFrame,lx=n.cancelAnimationFrame,!g_){const e=["ms","moz","webkit","o"];for(const t of e)g_=n[`${t}RequestAnimationFrame`],lx=n[`${t}CancelAnimationFrame`]||n[`${t}CancelRequestAnimationFrame`]}g_=g_&&g_.bind(n),lx=lx&&lx.bind(n),g_||(g_=e=>{const t=Date.now(),i=Math.max(0,16-(t-Mlt)),s=n.setTimeout(()=>{e(t+i)},i);return Mlt=t+i,s},lx=e=>clearTimeout(e))}const aR={request:n=>g_(n),cancel:n=>lx(n),init:MKn};function lR(n,e,t){if(t=t||{},ut.string(n)&&n.search(" ")!==-1&&(n=Blt(n)),ut.array(n))return n.reduce((i,s)=>In(i,lR(s,e,t)),t);if(ut.object(n)&&(e=n,n=""),ut.func(e))t[n]=t[n]||[],t[n].push(e);else if(ut.array(e))for(const i of e)lR(n,i,t);else if(ut.object(e))for(const i in e){const s=Blt(i).map(r=>`${n}${r}`);lR(s,e[i],t)}return t}function Blt(n){return n.trim().split(/ +/)}function Flt(n,e){for(const t of e){if(n.immediatePropagationStopped)break;t(n)}}class Olt{constructor(e){at(this,"options"),at(this,"types",{}),at(this,"propagationStopped",!1),at(this,"immediatePropagationStopped",!1),at(this,"global"),this.options=In({},e||{})}fire(e){let t;const i=this.global;(t=this.types[e.type])&&Flt(e,t),!e.propagationStopped&&i&&(t=i[e.type])&&Flt(e,t)}on(e,t){const i=lR(e,t);for(e in i)this.types[e]=Nlt(this.types[e]||[],i[e])}off(e,t){const i=lR(e,t);for(e in i){const s=this.types[e];if(!(!s||!s.length))for(const r of i[e]){const o=s.indexOf(r);o!==-1&&s.splice(o,1)}}}getRect(e){return null}}function Plt(n,e,t){return n==="parent"?I0(t):n==="self"?e.getRect(t):vlt(t,n)}function tV(n,e,t,i){let s=n;return ut.string(s)?s=Plt(s,e,t):ut.func(s)&&(s=s(...i)),ut.element(s)&&(s=V1e(s)),s}function EG(n){return n&&{x:"x"in n?n.x:n.left,y:"y"in n?n.y:n.top}}function BKn(n){return n&&!("left"in n&&"top"in n)&&(n=In({},n),n.left=n.x||0,n.top=n.y||0,n.right=n.right||n.left+n.width,n.bottom=n.bottom||n.top+n.height),n}function Vlt(n){return n&&!("x"in n&&"y"in n)&&(n=In({},n),n.x=n.left||0,n.y=n.top||0,n.width=n.width||(n.right||0)-n.x,n.height=n.height||(n.bottom||0)-n.y),n}function z1e(n,e,t){n.left&&(e.left+=t.x),n.right&&(e.right+=t.x),n.top&&(e.top+=t.y),n.bottom&&(e.bottom+=t.y),e.width=e.right-e.left,e.height=e.bottom-e.top}function Q1e(n,e,t){const i=n.options[t],s=i&&i.origin||n.options.origin,r=tV(s,n,e,[n&&e]);return EG(r)||{x:0,y:0}}const xG=(n,e)=>Math.sqrt(n*n+e*e);class Ult{constructor(e){at(this,"immediatePropagationStopped",!1),at(this,"propagationStopped",!1),this._interaction=e}preventDefault(){}stopPropagation(){this.propagationStopped=!0}stopImmediatePropagation(){this.immediatePropagationStopped=this.propagationStopped=!0}}Object.defineProperty(Ult.prototype,"interaction",{get(){return this._interaction._proxy},set(){}});const Hlt={base:{preventDefault:"auto",deltaSource:"page"},perAction:{enabled:!1,origin:{x:0,y:0}},actions:{}};class q1e extends Ult{constructor(e,t,i,s,r,o,a){super(e),at(this,"relatedTarget",null),at(this,"screenX"),at(this,"screenY"),at(this,"button"),at(this,"buttons"),at(this,"ctrlKey"),at(this,"shiftKey"),at(this,"altKey"),at(this,"metaKey"),at(this,"page"),at(this,"client"),at(this,"delta"),at(this,"rect"),at(this,"x0"),at(this,"y0"),at(this,"t0"),at(this,"dt"),at(this,"duration"),at(this,"clientX0"),at(this,"clientY0"),at(this,"velocity"),at(this,"speed"),at(this,"swipe"),at(this,"axes"),at(this,"preEnd"),r=r||e.element;const l=e.interactable,c=(l&&l.options||Hlt).deltaSource,d=Q1e(l,r,i),u=s==="start",f=s==="end",g=u?this:e.prevEvent,p=u?e.coords.start:f?{page:g.page,client:g.client,timeStamp:e.coords.cur.timeStamp}:e.coords.cur;this.page=In({},p.page),this.client=In({},p.client),this.rect=In({},e.rect),this.timeStamp=p.timeStamp,f||(this.page.x-=d.x,this.page.y-=d.y,this.client.x-=d.x,this.client.y-=d.y),this.ctrlKey=t.ctrlKey,this.altKey=t.altKey,this.shiftKey=t.shiftKey,this.metaKey=t.metaKey,this.button=t.button,this.buttons=t.buttons,this.target=r,this.currentTarget=r,this.preEnd=o,this.type=a||i+(s||""),this.interactable=l,this.t0=u?e.pointers[e.pointers.length-1].downTime:g.t0,this.x0=e.coords.start.page.x-d.x,this.y0=e.coords.start.page.y-d.y,this.clientX0=e.coords.start.client.x-d.x,this.clientY0=e.coords.start.client.y-d.y,u||f?this.delta={x:0,y:0}:this.delta={x:this[c].x-g[c].x,y:this[c].y-g[c].y},this.dt=e.coords.delta.timeStamp,this.duration=this.timeStamp-this.t0,this.velocity=In({},e.coords.velocity[c]),this.speed=xG(this.velocity.x,this.velocity.y),this.swipe=f||s==="inertiastart"?this.getSwipe():null}getSwipe(){const e=this._interaction;if(e.prevEvent.speed<600||this.timeStamp-e.prevEvent.timeStamp>150)return null;let t=180*Math.atan2(e.prevEvent.velocityY,e.prevEvent.velocityX)/Math.PI;const i=22.5;t<0&&(t+=360);const s=135-i<=t&&t<225+i,r=225-i<=t&&t<315+i,o=!s&&(315-i<=t||t<45+i),a=!r&&45-i<=t&&t<135+i;return{up:r,down:a,left:s,right:o,angle:t,speed:e.prevEvent.speed,velocity:{x:e.prevEvent.velocityX,y:e.prevEvent.velocityY}}}preventDefault(){}stopImmediatePropagation(){this.immediatePropagationStopped=this.propagationStopped=!0}stopPropagation(){this.propagationStopped=!0}}Object.defineProperties(q1e.prototype,{pageX:{get(){return this.page.x},set(n){this.page.x=n}},pageY:{get(){return this.page.y},set(n){this.page.y=n}},clientX:{get(){return this.client.x},set(n){this.client.x=n}},clientY:{get(){return this.client.y},set(n){this.client.y=n}},dx:{get(){return this.delta.x},set(n){this.delta.x=n}},dy:{get(){return this.delta.y},set(n){this.delta.y=n}},velocityX:{get(){return this.velocity.x},set(n){this.velocity.x=n}},velocityY:{get(){return this.velocity.y},set(n){this.velocity.y=n}}});function $lt(n,e){n.__set||(n.__set={});for(const t in e)typeof n[t]!="function"&&t!=="__set"&&Object.defineProperty(n,t,{get(){return t in n.__set?n.__set[t]:n.__set[t]=e[t]},set(i){n.__set[t]=i},configurable:!0});return n}function K1e(n,e){n.page=n.page||{},n.page.x=e.page.x,n.page.y=e.page.y,n.client=n.client||{},n.client.x=e.client.x,n.client.y=e.client.y,n.timeStamp=e.timeStamp}function FKn(n,e,t){n.page.x=t.page.x-e.page.x,n.page.y=t.page.y-e.page.y,n.client.x=t.client.x-e.client.x,n.client.y=t.client.y-e.client.y,n.timeStamp=t.timeStamp-e.timeStamp}function OKn(n,e){const t=Math.max(e.timeStamp/1e3,.001);n.page.x=e.page.x/t,n.page.y=e.page.y/t,n.client.x=e.client.x/t,n.client.y=e.client.y/t,n.timeStamp=t}function PKn(n){n.page.x=0,n.page.y=0,n.client.x=0,n.client.y=0}function Wlt(n){return n instanceof Uu.Event||n instanceof Uu.Touch}function kG(n,e,t){return t=t||{},n=n||"page",t.x=e[n+"X"],t.y=e[n+"Y"],t}function VKn(n,e){return e=e||{x:0,y:0},Bp.isOperaMobile&&Wlt(n)?(kG("screen",n,e),e.x+=window.scrollX,e.y+=window.scrollY):kG("page",n,e),e}function UKn(n,e){return e=e||{},Bp.isOperaMobile&&Wlt(n)?kG("screen",n,e):kG("client",n,e),e}function TG(n){return ut.number(n.pointerId)?n.pointerId:n.identifier}function HKn(n,e,t){const i=e.length>1?zlt(e):e[0];VKn(i,n.page),UKn(i,n.client),n.timeStamp=t}function j1e(n){const e=[];return ut.array(n)?(e[0]=n[0],e[1]=n[1]):n.type==="touchend"?n.touches.length===1?(e[0]=n.touches[0],e[1]=n.changedTouches[0]):n.touches.length===0&&(e[0]=n.changedTouches[0],e[1]=n.changedTouches[1]):(e[0]=n.touches[0],e[1]=n.touches[1]),e}function zlt(n){const e={pageX:0,pageY:0,clientX:0,clientY:0,screenX:0,screenY:0};for(const t of n)for(const i in e)e[i]+=t[i];for(const t in e)e[t]/=n.length;return e}function $Kn(n){if(!n.length)return null;const e=j1e(n),t=Math.min(e[0].pageX,e[1].pageX),i=Math.min(e[0].pageY,e[1].pageY),s=Math.max(e[0].pageX,e[1].pageX),r=Math.max(e[0].pageY,e[1].pageY);return{x:t,y:i,left:t,top:i,right:s,bottom:r,width:s-t,height:r-i}}function WKn(n,e){const t=e+"X",i=e+"Y",s=j1e(n),r=s[0][t]-s[1][t],o=s[0][i]-s[1][i];return xG(r,o)}function zKn(n,e){const t=e+"X",i=e+"Y",s=j1e(n),r=s[1][t]-s[0][t],o=s[1][i]-s[0][i];return 180*Math.atan2(o,r)/Math.PI}function QKn(n){return ut.string(n.pointerType)?n.pointerType:ut.number(n.pointerType)?[void 0,void 0,"touch","pen","mouse"][n.pointerType]:/touch/.test(n.type||"")||n instanceof Uu.Touch?"touch":"mouse"}function Qlt(n){const e=ut.func(n.composedPath)?n.composedPath():n.path;return[Slt(e?e[0]:n.target),Slt(n.currentTarget)]}function nV(){return{page:{x:0,y:0},client:{x:0,y:0},timeStamp:0}}function G1e(n,e){if(e.phaselessTypes[n])return!0;for(const t in e.map)if(n.indexOf(t)===0&&n.substr(t.length)in e.phases)return!0;return!1}function qKn(n){const e=(t,i)=>{let s=n.interactables.get(t,i);return s||(s=n.interactables.new(t,i),s.events.global=e.globalEvents),s};return e.getPointerAverage=zlt,e.getTouchBBox=$Kn,e.getTouchDistance=WKn,e.getTouchAngle=zKn,e.getElementRect=V1e,e.getElementClientRect=P1e,e.matchesSelector=ax,e.closest=vlt,e.globalEvents={},e.version="1.10.18",e.scope=n,e.use=function(t,i){return this.scope.usePlugin(t,i),this},e.isSet=function(t,i){return!!this.scope.interactables.get(t,i&&i.context)},e.on=eV(function(t,i,s){if(ut.string(t)&&t.search(" ")!==-1&&(t=t.trim().split(/ +/)),ut.array(t)){for(const r of t)this.on(r,i,s);return this}if(ut.object(t)){for(const r in t)this.on(r,t[r],i);return this}return G1e(t,this.scope.actions)?this.globalEvents[t]?this.globalEvents[t].push(i):this.globalEvents[t]=[i]:this.scope.events.add(this.scope.document,t,i,{options:s}),this},"The interact.on() method is being deprecated"),e.off=eV(function(t,i,s){if(ut.string(t)&&t.search(" ")!==-1&&(t=t.trim().split(/ +/)),ut.array(t)){for(const r of t)this.off(r,i,s);return this}if(ut.object(t)){for(const r in t)this.off(r,t[r],i);return this}if(G1e(t,this.scope.actions)){let r;t in this.globalEvents&&(r=this.globalEvents[t].indexOf(i))!==-1&&this.globalEvents[t].splice(r,1)}else this.scope.events.remove(this.scope.document,t,i,s);return this},"The interact.off() method is being deprecated"),e.debug=function(){return this.scope},e.supportsTouch=function(){return Bp.supportsTouch},e.supportsPointerEvent=function(){return Bp.supportsPointerEvent},e.stop=function(){for(const t of this.scope.interactions.list)t.stop();return this},e.pointerMoveTolerance=function(t){return ut.number(t)?(this.scope.interactions.pointerMoveTolerance=t,this):this.scope.interactions.pointerMoveTolerance},e.addDocument=function(t,i){this.scope.addDocument(t,i)},e.removeDocument=function(t){this.scope.removeDocument(t)},e}class KKn{constructor(e,t,i,s){at(this,"options"),at(this,"_actions"),at(this,"target"),at(this,"events",new Olt),at(this,"_context"),at(this,"_win"),at(this,"_doc"),at(this,"_scopeEvents"),at(this,"_rectChecker"),this._actions=t.actions,this.target=e,this._context=t.context||i,this._win=rx(Elt(e)?this._context:e),this._doc=this._win.document,this._scopeEvents=s,this.set(t)}get _defaults(){return{base:{},perAction:{},actions:{}}}setOnEvents(e,t){return ut.func(t.onstart)&&this.on(`${e}start`,t.onstart),ut.func(t.onmove)&&this.on(`${e}move`,t.onmove),ut.func(t.onend)&&this.on(`${e}end`,t.onend),ut.func(t.oninertiastart)&&this.on(`${e}inertiastart`,t.oninertiastart),this}updatePerActionListeners(e,t,i){(ut.array(t)||ut.object(t))&&this.off(e,t),(ut.array(i)||ut.object(i))&&this.on(e,i)}setPerAction(e,t){const i=this._defaults;for(const s in t){const r=s,o=this.options[e],a=t[r];r==="listeners"&&this.updatePerActionListeners(e,o.listeners,a),ut.array(a)?o[r]=Rlt(a):ut.plainObject(a)?(o[r]=In(o[r]||{},oR(a)),ut.object(i.perAction[r])&&"enabled"in i.perAction[r]&&(o[r].enabled=a.enabled!==!1)):ut.bool(a)&&ut.object(i.perAction[r])?o[r].enabled=a:o[r]=a}}getRect(e){return e=e||(ut.element(this.target)?this.target:null),ut.string(this.target)&&(e=e||this._context.querySelector(this.target)),V1e(e)}rectChecker(e){return ut.func(e)?(this._rectChecker=e,this.getRect=t=>{const i=In({},this._rectChecker(t));return"width"in i||(i.width=i.right-i.left,i.height=i.bottom-i.top),i},this):e===null?(delete this.getRect,delete this._rectChecker,this):this.getRect}_backCompatOption(e,t){if(Elt(t)||ut.object(t)){this.options[e]=t;for(const i in this._actions.map)this.options[i][e]=t;return this}return this.options[e]}origin(e){return this._backCompatOption("origin",e)}deltaSource(e){return e==="page"||e==="client"?(this.options.deltaSource=e,this):this.options.deltaSource}context(){return this._context}inContext(e){return this._context===e.ownerDocument||ox(this._context,e)}testIgnoreAllow(e,t,i){return!this.testIgnore(e.ignoreFrom,t,i)&&this.testAllow(e.allowFrom,t,i)}testAllow(e,t,i){return e?ut.element(i)?ut.string(e)?O1e(i,e,t):ut.element(e)?ox(e,i):!1:!1:!0}testIgnore(e,t,i){return!e||!ut.element(i)?!1:ut.string(e)?O1e(i,e,t):ut.element(e)?ox(e,i):!1}fire(e){return this.events.fire(e),this}_onOff(e,t,i,s){ut.object(t)&&!ut.array(t)&&(s=i,i=null);const r=e==="on"?"add":"remove",o=lR(t,i);for(let a in o){a==="wheel"&&(a=Bp.wheelEvent);for(const l of o[a])G1e(a,this._actions)?this.events[e](a,l):ut.string(this.target)?this._scopeEvents[`${r}Delegate`](this.target,this._context,a,l,s):this._scopeEvents[r](this.target,a,l,s)}return this}on(e,t,i){return this._onOff("on",e,t,i)}off(e,t,i){return this._onOff("off",e,t,i)}set(e){const t=this._defaults;ut.object(e)||(e={}),this.options=oR(t.base);for(const i in this._actions.methodDict){const s=i,r=this._actions.methodDict[s];this.options[s]={},this.setPerAction(s,In(In({},t.perAction),t.actions[s])),this[r](e[s])}for(const i in e)ut.func(this[i])&&this[i](e[i]);return this}unset(){if(ut.string(this.target))for(const e in this._scopeEvents.delegatedEvents){const t=this._scopeEvents.delegatedEvents[e];for(let i=t.length-1;i>=0;i--){const{selector:s,context:r,listeners:o}=t[i];s===this.target&&r===this._context&&t.splice(i,1);for(let a=o.length-1;a>=0;a--)this._scopeEvents.removeDelegate(this.target,this._context,e,o[a][0],o[a][1])}}else this._scopeEvents.remove(this.target,"all")}}class jKn{constructor(e){at(this,"list",[]),at(this,"selectorMap",{}),at(this,"scope"),this.scope=e,e.addListeners({"interactable:unset":({interactable:t})=>{const{target:i,_context:s}=t,r=ut.string(i)?this.selectorMap[i]:i[this.scope.id],o=SG(r,a=>a.context===s);r[o]&&(r[o].context=null,r[o].interactable=null),r.splice(o,1)}})}new(e,t){t=In(t||{},{actions:this.scope.actions});const i=new this.scope.Interactable(e,t,this.scope.document,this.scope.events),s={context:i._context,interactable:i};return this.scope.addDocument(i._doc),this.list.push(i),ut.string(e)?(this.selectorMap[e]||(this.selectorMap[e]=[]),this.selectorMap[e].push(s)):(i.target[this.scope.id]||Object.defineProperty(e,this.scope.id,{value:[],configurable:!0}),e[this.scope.id].push(s)),this.scope.fire("interactable:new",{target:e,options:t,interactable:i,win:this.scope._win}),i}get(e,t){const i=t&&t.context||this.scope.document,s=ut.string(e),r=s?this.selectorMap[e]:e[this.scope.id];if(!r)return null;const o=W1e(r,a=>a.context===i&&(s||a.interactable.inContext(e)));return o&&o.interactable}forEachMatch(e,t){for(const i of this.list){let s;if((ut.string(i.target)?ut.element(e)&&ax(e,i.target):e===i.target)&&i.inContext(e)&&(s=t(i)),s!==void 0)return s}}}function GKn(n){var e;const t=[],i={},s=[],r={add:o,remove:a,addDelegate:l,removeDelegate:c,delegateListener:d,delegateUseCapture:u,delegatedEvents:i,documents:s,targets:t,supportsOptions:!1,supportsPassive:!1};(e=n.document)==null||e.createElement("div").addEventListener("test",null,{get capture(){return r.supportsOptions=!0},get passive(){return r.supportsPassive=!0}}),n.events=r;function o(f,g,p,m){const A=iV(m);let b=W1e(t,y=>y.eventTarget===f);b||(b={eventTarget:f,events:{}},t.push(b)),b.events[g]||(b.events[g]=[]),f.addEventListener&&!RKn(b.events[g],p)&&(f.addEventListener(g,p,r.supportsOptions?A:A.capture),b.events[g].push(p))}function a(f,g,p,m){const A=iV(m),b=SG(t,C=>C.eventTarget===f),y=t[b];if(!y||!y.events)return;if(g==="all"){for(g in y.events)y.events.hasOwnProperty(g)&&a(f,g,"all");return}let _=!1;const w=y.events[g];if(w){if(p==="all"){for(let C=w.length-1;C>=0;C--)a(f,g,w[C],A);return}else for(let C=0;C<w.length;C++)if(w[C]===p){f.removeEventListener(g,p,r.supportsOptions?A:A.capture),w.splice(C,1),w.length===0&&(delete y.events[g],_=!0);break}}_&&!Object.keys(y.events).length&&t.splice(b,1)}function l(f,g,p,m,A){const b=iV(A);if(!i[p]){i[p]=[];for(const w of s)o(w,p,d),o(w,p,u,!0)}const y=i[p];let _=W1e(y,w=>w.selector===f&&w.context===g);_||(_={selector:f,context:g,listeners:[]},y.push(_)),_.listeners.push([m,b])}function c(f,g,p,m,A){const b=iV(A),y=i[p];let _=!1,w;if(y)for(w=y.length-1;w>=0;w--){const C=y[w];if(C.selector===f&&C.context===g){const{listeners:E}=C;for(let S=E.length-1;S>=0;S--){const[x,{capture:k,passive:I}]=E[S];if(x===m&&k===b.capture&&I===b.passive){E.splice(S,1),E.length||(y.splice(w,1),a(g,p,d),a(g,p,u,!0)),_=!0;break}}if(_)break}}}function d(f,g){const p=iV(g),m=new YKn(f),A=i[f.type],[b]=Qlt(f);let y=b;for(;ut.element(y);){for(let _=0;_<A.length;_++){const w=A[_],{selector:C,context:E}=w;if(ax(y,C)&&ox(E,b)&&ox(E,y)){const{listeners:S}=w;m.currentTarget=y;for(const[x,{capture:k,passive:I}]of S)k===p.capture&&I===p.passive&&x(m)}}y=I0(y)}}function u(f){return d.call(this,f,!0)}return r}class YKn{constructor(e){at(this,"currentTarget"),at(this,"originalEvent"),at(this,"type"),this.originalEvent=e,$lt(this,e)}preventOriginalDefault(){this.originalEvent.preventDefault()}stopPropagation(){this.originalEvent.stopPropagation()}stopImmediatePropagation(){this.originalEvent.stopImmediatePropagation()}}function iV(n){if(!ut.object(n))return{capture:!!n,passive:!1};const e=In({},n);return e.capture=!!n.capture,e.passive=!!n.passive,e}const XKn={id:"events",install:GKn};class ZKn{constructor(e,t,i,s,r){at(this,"id"),at(this,"pointer"),at(this,"event"),at(this,"downTime"),at(this,"downTarget"),this.id=e,this.pointer=t,this.event=i,this.downTime=s,this.downTarget=r}}let Y1e;(function(n){n.interactable="",n.element="",n.prepared="",n.pointerIsDown="",n.pointerWasMoved="",n._proxy=""})(Y1e||(Y1e={}));let X1e;(function(n){n.start="",n.move="",n.end="",n.stop="",n.interacting=""})(X1e||(X1e={}));let JKn=0;class ejn{constructor({pointerType:e,scopeFire:t}){at(this,"interactable",null),at(this,"element",null),at(this,"rect",null),at(this,"_rects"),at(this,"edges",null),at(this,"_scopeFire"),at(this,"prepared",{name:null,axis:null,edges:null}),at(this,"pointerType"),at(this,"pointers",[]),at(this,"downEvent",null),at(this,"downPointer",{}),at(this,"_latestPointer",{pointer:null,event:null,eventTarget:null}),at(this,"prevEvent",null),at(this,"pointerIsDown",!1),at(this,"pointerWasMoved",!1),at(this,"_interacting",!1),at(this,"_ending",!1),at(this,"_stopped",!0),at(this,"_proxy",null),at(this,"simulation",null),at(this,"doMove",eV(function(s){this.move(s)},"The interaction.doMove() method has been renamed to interaction.move()")),at(this,"coords",{start:nV(),prev:nV(),cur:nV(),delta:nV(),velocity:nV()}),at(this,"_id",JKn++),this._scopeFire=t,this.pointerType=e;const i=this;this._proxy={};for(const s in Y1e)Object.defineProperty(this._proxy,s,{get(){return i[s]}});for(const s in X1e)Object.defineProperty(this._proxy,s,{value:(...r)=>i[s](...r)});this._scopeFire("interactions:new",{interaction:this})}get pointerMoveTolerance(){return 1}pointerDown(e,t,i){const s=this.updatePointer(e,t,i,!0),r=this.pointers[s];this._scopeFire("interactions:down",{pointer:e,event:t,eventTarget:i,pointerIndex:s,pointerInfo:r,type:"down",interaction:this})}start(e,t,i){return this.interacting()||!this.pointerIsDown||this.pointers.length<(e.name==="gesture"?2:1)||!t.options[e.name].enabled?!1:(xlt(this.prepared,e),this.interactable=t,this.element=i,this.rect=t.getRect(i),this.edges=this.prepared.edges?In({},this.prepared.edges):{left:!0,right:!0,top:!0,bottom:!0},this._stopped=!1,this._interacting=this._doPhase({interaction:this,event:this.downEvent,phase:"start"})&&!this._stopped,this._interacting)}pointerMove(e,t,i){!this.simulation&&!(this.modification&&this.modification.endResult)&&this.updatePointer(e,t,i,!1);const s=this.coords.cur.page.x===this.coords.prev.page.x&&this.coords.cur.page.y===this.coords.prev.page.y&&this.coords.cur.client.x===this.coords.prev.client.x&&this.coords.cur.client.y===this.coords.prev.client.y;let r,o;this.pointerIsDown&&!this.pointerWasMoved&&(r=this.coords.cur.client.x-this.coords.start.client.x,o=this.coords.cur.client.y-this.coords.start.client.y,this.pointerWasMoved=xG(r,o)>this.pointerMoveTolerance);const a=this.getPointerIndex(e),l={pointer:e,pointerIndex:a,pointerInfo:this.pointers[a],event:t,type:"move",eventTarget:i,dx:r,dy:o,duplicate:s,interaction:this};s||OKn(this.coords.velocity,this.coords.delta),this._scopeFire("interactions:move",l),!s&&!this.simulation&&(this.interacting()&&(l.type=null,this.move(l)),this.pointerWasMoved&&K1e(this.coords.prev,this.coords.cur))}move(e){(!e||!e.event)&&PKn(this.coords.delta),e=In({pointer:this._latestPointer.pointer,event:this._latestPointer.event,eventTarget:this._latestPointer.eventTarget,interaction:this},e||{}),e.phase="move",this._doPhase(e)}pointerUp(e,t,i,s){let r=this.getPointerIndex(e);r===-1&&(r=this.updatePointer(e,t,i,!1));const o=/cancel$/i.test(t.type)?"cancel":"up";this._scopeFire(`interactions:${o}`,{pointer:e,pointerIndex:r,pointerInfo:this.pointers[r],event:t,eventTarget:i,type:o,curEventTarget:s,interaction:this}),this.simulation||this.end(t),this.removePointer(e,t)}documentBlur(e){this.end(e),this._scopeFire("interactions:blur",{event:e,type:"blur",interaction:this})}end(e){this._ending=!0,e=e||this._latestPointer.event;let t;this.interacting()&&(t=this._doPhase({event:e,interaction:this,phase:"end"})),this._ending=!1,t===!0&&this.stop()}currentAction(){return this._interacting?this.prepared.name:null}interacting(){return this._interacting}stop(){this._scopeFire("interactions:stop",{interaction:this}),this.interactable=this.element=null,this._interacting=!1,this._stopped=!0,this.prepared.name=this.prevEvent=null}getPointerIndex(e){const t=TG(e);return this.pointerType==="mouse"||this.pointerType==="pen"?this.pointers.length-1:SG(this.pointers,i=>i.id===t)}getPointerInfo(e){return this.pointers[this.getPointerIndex(e)]}updatePointer(e,t,i,s){const r=TG(e);let o=this.getPointerIndex(e),a=this.pointers[o];return s=s===!1?!1:s||/(down|start)$/i.test(t.type),a?a.pointer=e:(a=new ZKn(r,e,t,null,null),o=this.pointers.length,this.pointers.push(a)),HKn(this.coords.cur,this.pointers.map(l=>l.pointer),this._now()),FKn(this.coords.delta,this.coords.prev,this.coords.cur),s&&(this.pointerIsDown=!0,a.downTime=this.coords.cur.timeStamp,a.downTarget=i,$lt(this.downPointer,e),this.interacting()||(K1e(this.coords.start,this.coords.cur),K1e(this.coords.prev,this.coords.cur),this.downEvent=t,this.pointerWasMoved=!1)),this._updateLatestPointer(e,t,i),this._scopeFire("interactions:update-pointer",{pointer:e,event:t,eventTarget:i,down:s,pointerInfo:a,pointerIndex:o,interaction:this}),o}removePointer(e,t){const i=this.getPointerIndex(e);if(i===-1)return;const s=this.pointers[i];this._scopeFire("interactions:remove-pointer",{pointer:e,event:t,eventTarget:null,pointerIndex:i,pointerInfo:s,interaction:this}),this.pointers.splice(i,1),this.pointerIsDown=!1}_updateLatestPointer(e,t,i){this._latestPointer.pointer=e,this._latestPointer.event=t,this._latestPointer.eventTarget=i}destroy(){this._latestPointer.pointer=null,this._latestPointer.event=null,this._latestPointer.eventTarget=null}_createPreparedEvent(e,t,i,s){return new q1e(this,e,this.prepared.name,t,this.element,i,s)}_fireEvent(e){var t;(t=this.interactable)==null||t.fire(e),(!this.prevEvent||e.timeStamp>=this.prevEvent.timeStamp)&&(this.prevEvent=e)}_doPhase(e){const{event:t,phase:i,preEnd:s,type:r}=e,{rect:o}=this;if(o&&i==="move"&&(z1e(this.edges,o,this.coords.delta[this.interactable.options.deltaSource]),o.width=o.right-o.left,o.height=o.bottom-o.top),this._scopeFire(`interactions:before-action-${i}`,e)===!1)return!1;const a=e.iEvent=this._createPreparedEvent(t,i,s,r);return this._scopeFire(`interactions:action-${i}`,e),i==="start"&&(this.prevEvent=a),this._fireEvent(a),this._scopeFire(`interactions:after-action-${i}`,e),!0}_now(){return Date.now()}}const tjn=ejn;function njn(n){return/^(always|never|auto)$/.test(n)?(this.options.preventDefault=n,this):ut.bool(n)?(this.options.preventDefault=n?"always":"never",this):this.options.preventDefault}function ijn(n,e,t){const i=n.options.preventDefault;if(i!=="never"){if(i==="always"){t.preventDefault();return}if(e.events.supportsPassive&&/^touch(start|move)$/.test(t.type)){const s=rx(t.target).document,r=e.getDocOptions(s);if(!(r&&r.events)||r.events.passive!==!1)return}/^(mouse|pointer|touch)*(down|start)/i.test(t.type)||ut.element(t.target)&&ax(t.target,"input,select,textarea,[contenteditable=true],[contenteditable=true] *")||t.preventDefault()}}function sjn({interaction:n,event:e}){n.interactable&&n.interactable.checkAndPreventDefault(e)}function rjn(n){const{Interactable:e}=n;e.prototype.preventDefault=njn,e.prototype.checkAndPreventDefault=function(t){return ijn(this,n,t)},n.interactions.docEvents.push({type:"dragstart",listener(t){for(const i of n.interactions.list)if(i.element&&(i.element===t.target||ox(i.element,t.target))){i.interactable.checkAndPreventDefault(t);return}}})}const ojn={id:"core/interactablePreventDefault",install:rjn,listeners:["down","move","up","cancel"].reduce((n,e)=>(n[`interactions:${e}`]=sjn,n),{})},Z1e={methodOrder:["simulationResume","mouseOrPen","hasPointer","idle"],search(n){for(const e of Z1e.methodOrder){const t=Z1e[e](n);if(t)return t}return null},simulationResume({pointerType:n,eventType:e,eventTarget:t,scope:i}){if(!/down|start/i.test(e))return null;for(const s of i.interactions.list){let r=t;if(s.simulation&&s.simulation.allowResume&&s.pointerType===n)for(;r;){if(r===s.element)return s;r=I0(r)}}return null},mouseOrPen({pointerId:n,pointerType:e,eventType:t,scope:i}){if(e!=="mouse"&&e!=="pen")return null;let s;for(const r of i.interactions.list)if(r.pointerType===e){if(r.simulation&&!qlt(r,n))continue;if(r.interacting())return r;s||(s=r)}if(s)return s;for(const r of i.interactions.list)if(r.pointerType===e&&!(/down/i.test(t)&&r.simulation))return r;return null},hasPointer({pointerId:n,scope:e}){for(const t of e.interactions.list)if(qlt(t,n))return t;return null},idle({pointerType:n,scope:e}){for(const t of e.interactions.list){if(t.pointers.length===1){const i=t.interactable;if(i&&!(i.options.gesture&&i.options.gesture.enabled))continue}else if(t.pointers.length>=2)continue;if(!t.interacting()&&n===t.pointerType)return t}return null}};function qlt(n,e){return n.pointers.some(({id:t})=>t===e)}const ajn=Z1e,Klt=["pointerDown","pointerMove","pointerUp","updatePointer","removePointer","windowBlur"];function ljn(n){const e={};for(const r of Klt)e[r]=jlt(r,n);const t=Bp.pEventTypes;let i;Uu.PointerEvent?i=[{type:t.down,listener:s},{type:t.down,listener:e.pointerDown},{type:t.move,listener:e.pointerMove},{type:t.up,listener:e.pointerUp},{type:t.cancel,listener:e.pointerUp}]:i=[{type:"mousedown",listener:e.pointerDown},{type:"mousemove",listener:e.pointerMove},{type:"mouseup",listener:e.pointerUp},{type:"touchstart",listener:s},{type:"touchstart",listener:e.pointerDown},{type:"touchmove",listener:e.pointerMove},{type:"touchend",listener:e.pointerUp},{type:"touchcancel",listener:e.pointerUp}],i.push({type:"blur",listener(r){for(const o of n.interactions.list)o.documentBlur(r)}}),n.prevTouchTime=0,n.Interaction=class extends tjn{get pointerMoveTolerance(){return n.interactions.pointerMoveTolerance}set pointerMoveTolerance(r){n.interactions.pointerMoveTolerance=r}_now(){return n.now()}},n.interactions={list:[],new(r){r.scopeFire=(a,l)=>n.fire(a,l);const o=new n.Interaction(r);return n.interactions.list.push(o),o},listeners:e,docEvents:i,pointerMoveTolerance:1};function s(){for(const r of n.interactions.list)if(!(!r.pointerIsDown||r.pointerType!=="touch"||r._interacting))for(const o of r.pointers)n.documents.some(({doc:a})=>ox(a,o.downTarget))||r.removePointer(o.pointer,o.event)}n.usePlugin(ojn)}function jlt(n,e){return function(t){const i=e.interactions.list,s=QKn(t),[r,o]=Qlt(t),a=[];if(/^touch/.test(t.type)){e.prevTouchTime=e.now();for(const l of t.changedTouches){const c=l,d=TG(c),u={pointer:c,pointerId:d,pointerType:s,eventType:t.type,eventTarget:r,curEventTarget:o,scope:e},f=Glt(u);a.push([u.pointer,u.eventTarget,u.curEventTarget,f])}}else{let l=!1;if(!Bp.supportsPointerEvent&&/mouse/.test(t.type)){for(let c=0;c<i.length&&!l;c++)l=i[c].pointerType!=="mouse"&&i[c].pointerIsDown;l=l||e.now()-e.prevTouchTime<500||t.timeStamp===0}if(!l){const c={pointer:t,pointerId:TG(t),pointerType:s,eventType:t.type,curEventTarget:o,eventTarget:r,scope:e},d=Glt(c);a.push([c.pointer,c.eventTarget,c.curEventTarget,d])}}for(const[l,c,d,u]of a)u[n](l,t,c,d)}}function Glt(n){const{pointerType:e,scope:t}=n,i={interaction:ajn.search(n),searchDetails:n};return t.fire("interactions:find",i),i.interaction||t.interactions.new({pointerType:e})}function J1e({doc:n,scope:e,options:t},i){const{interactions:{docEvents:s},events:r}=e,o=r[i];e.browser.isIOS&&!t.events&&(t.events={passive:!1});for(const l in r.delegatedEvents)o(n,l,r.delegateListener),o(n,l,r.delegateUseCapture,!0);const a=t&&t.events;for(const{type:l,listener:c}of s)o(n,l,c,a)}const cjn={id:"core/interactions",install:ljn,listeners:{"scope:add-document":n=>J1e(n,"add"),"scope:remove-document":n=>J1e(n,"remove"),"interactable:unset":({interactable:n},e)=>{for(let t=e.interactions.list.length-1;t>=0;t--){const i=e.interactions.list[t];i.interactable===n&&(i.stop(),e.fire("interactions:destroy",{interaction:i}),i.destroy(),e.interactions.list.length>2&&e.interactions.list.splice(t,1))}}},onDocSignal:J1e,doOnInteractions:jlt,methodNames:Klt},djn=cjn;class ujn{constructor(){at(this,"id",`__interact_scope_${Math.floor(Math.random()*100)}`),at(this,"isInitialized",!1),at(this,"listenerMaps",[]),at(this,"browser",Bp),at(this,"defaults",oR(Hlt)),at(this,"Eventable",Olt),at(this,"actions",{map:{},phases:{start:!0,move:!0,end:!0},methodDict:{},phaselessTypes:{}}),at(this,"interactStatic",qKn(this)),at(this,"InteractEvent",q1e),at(this,"Interactable"),at(this,"interactables",new jKn(this)),at(this,"_win"),at(this,"document"),at(this,"window"),at(this,"documents",[]),at(this,"_plugins",{list:[],map:{}}),at(this,"onWindowUnload",t=>this.removeDocument(t.target));const e=this;this.Interactable=class extends KKn{get _defaults(){return e.defaults}set(t){return super.set(t),e.fire("interactable:set",{options:t,interactable:this}),this}unset(){super.unset();const t=e.interactables.list.indexOf(this);t<0||(super.unset(),e.interactables.list.splice(t,1),e.fire("interactable:unset",{interactable:this}))}}}addListeners(e,t){this.listenerMaps.push({id:t,map:e})}fire(e,t){for(const{map:{[e]:i}}of this.listenerMaps)if(i&&i(t,this,e)===!1)return!1}init(e){return this.isInitialized?this:hjn(this,e)}pluginIsInstalled(e){return this._plugins.map[e.id]||this._plugins.list.indexOf(e)!==-1}usePlugin(e,t){if(!this.isInitialized)return this;if(this.pluginIsInstalled(e))return this;if(e.id&&(this._plugins.map[e.id]=e),this._plugins.list.push(e),e.install&&e.install(this,t),e.listeners&&e.before){let i=0;const s=this.listenerMaps.length,r=e.before.reduce((o,a)=>(o[a]=!0,o[Ylt(a)]=!0,o),{});for(;i<s;i++){const o=this.listenerMaps[i].id;if(r[o]||r[Ylt(o)])break}this.listenerMaps.splice(i,0,{id:e.id,map:e.listeners})}else e.listeners&&this.listenerMaps.push({id:e.id,map:e.listeners});return this}addDocument(e,t){if(this.getDocIndex(e)!==-1)return!1;const i=rx(e);t=t?In({},t):{},this.documents.push({doc:e,options:t}),this.events.documents.push(e),e!==this.document&&this.events.add(i,"unload",this.onWindowUnload),this.fire("scope:add-document",{doc:e,window:i,scope:this,options:t})}removeDocument(e){const t=this.getDocIndex(e),i=rx(e),s=this.documents[t].options;this.events.remove(i,"unload",this.onWindowUnload),this.documents.splice(t,1),this.events.documents.splice(t,1),this.fire("scope:remove-document",{doc:e,window:i,scope:this,options:s})}getDocIndex(e){for(let t=0;t<this.documents.length;t++)if(this.documents[t].doc===e)return t;return-1}getDocOptions(e){const t=this.getDocIndex(e);return t===-1?null:this.documents[t].options}now(){return(this.window.Date||Date).now()}}function hjn(n,e){return n.isInitialized=!0,ut.window(e)&&wlt(e),Uu.init(e),Bp.init(e),aR.init(e),n.window=e,n.document=e.document,n.usePlugin(djn),n.usePlugin(XKn),n}function Ylt(n){return n&&n.replace(/\/.*$/,"")}const Xlt=new ujn,fjn=Xlt.interactStatic,p_=fjn,gjn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:globalThis;Xlt.init(gjn),p_.use(NKn);function pjn(n){const{defaults:e,actions:t}=n;n.autoScroll=ei,ei.now=()=>n.now(),t.phaselessTypes.autoscroll=!0,e.perAction.autoScroll=ei.defaults}const ei={defaults:{enabled:!1,margin:60,container:null,speed:300},now:Date.now,interaction:null,i:0,x:0,y:0,isScrolling:!1,prevTime:0,margin:0,speed:0,start(n){ei.isScrolling=!0,aR.cancel(ei.i),n.autoScroll=ei,ei.interaction=n,ei.prevTime=ei.now(),ei.i=aR.request(ei.scroll)},stop(){ei.isScrolling=!1,ei.interaction&&(ei.interaction.autoScroll=null),aR.cancel(ei.i)},scroll(){const{interaction:n}=ei,{interactable:e,element:t}=n,i=n.prepared.name,s=e.options[i].autoScroll,r=Zlt(s.container,e,t),o=ei.now(),a=(o-ei.prevTime)/1e3,l=s.speed*a;if(l>=1){const c={x:ei.x*l,y:ei.y*l};if(c.x||c.y){const d=Jlt(r);ut.window(r)?r.scrollBy(c.x,c.y):r&&(r.scrollLeft+=c.x,r.scrollTop+=c.y);const u=Jlt(r),f={x:u.x-d.x,y:u.y-d.y};(f.x||f.y)&&e.fire({type:"autoscroll",target:t,interactable:e,delta:f,interaction:n,container:r})}ei.prevTime=o}ei.isScrolling&&(aR.cancel(ei.i),ei.i=aR.request(ei.scroll))},check(n,e){var t;return(t=n.options[e].autoScroll)==null?void 0:t.enabled},onInteractionMove({interaction:n,pointer:e}){if(!(n.interacting()&&ei.check(n.interactable,n.prepared.name)))return;if(n.simulation){ei.x=ei.y=0;return}let t,i,s,r;const{interactable:o,element:a}=n,l=n.prepared.name,c=o.options[l].autoScroll,d=Zlt(c.container,o,a);if(ut.window(d))r=e.clientX<ei.margin,t=e.clientY<ei.margin,i=e.clientX>d.innerWidth-ei.margin,s=e.clientY>d.innerHeight-ei.margin;else{const u=P1e(d);r=e.clientX<u.left+ei.margin,t=e.clientY<u.top+ei.margin,i=e.clientX>u.right-ei.margin,s=e.clientY>u.bottom-ei.margin}ei.x=i?1:r?-1:0,ei.y=s?1:t?-1:0,ei.isScrolling||(ei.margin=c.margin,ei.speed=c.speed,ei.start(n))}};function Zlt(n,e,t){return(ut.string(n)?Plt(n,e,t):n)||rx(t)}function Jlt(n){return ut.window(n)&&(n=window.document.body),{x:n.scrollLeft,y:n.scrollTop}}const mjn={id:"auto-scroll",install:pjn,listeners:{"interactions:new":({interaction:n})=>{n.autoScroll=null},"interactions:destroy":({interaction:n})=>{n.autoScroll=null,ei.stop(),ei.interaction&&(ei.interaction=null)},"interactions:stop":ei.stop,"interactions:action-move":n=>ei.onInteractionMove(n)}},Ajn=mjn;p_.use(Ajn);function bjn(n){const{actions:e,Interactable:t,defaults:i}=n;t.prototype.draggable=LG.draggable,e.map.drag=LG,e.methodDict.drag="draggable",i.actions.drag=LG.defaults}function eSe({interaction:n}){if(n.prepared.name!=="drag")return;const e=n.prepared.axis;e==="x"?(n.coords.cur.page.y=n.coords.start.page.y,n.coords.cur.client.y=n.coords.start.client.y,n.coords.velocity.client.y=0,n.coords.velocity.page.y=0):e==="y"&&(n.coords.cur.page.x=n.coords.start.page.x,n.coords.cur.client.x=n.coords.start.client.x,n.coords.velocity.client.x=0,n.coords.velocity.page.x=0)}function ect({iEvent:n,interaction:e}){if(e.prepared.name!=="drag")return;const t=e.prepared.axis;if(t==="x"||t==="y"){const i=t==="x"?"y":"x";n.page[i]=e.coords.start.page[i],n.client[i]=e.coords.start.client[i],n.delta[i]=0}}const yjn=function(n){return ut.object(n)?(this.options.drag.enabled=n.enabled!==!1,this.setPerAction("drag",n),this.setOnEvents("drag",n),/^(xy|x|y|start)$/.test(n.lockAxis)&&(this.options.drag.lockAxis=n.lockAxis),/^(xy|x|y)$/.test(n.startAxis)&&(this.options.drag.startAxis=n.startAxis),this):ut.bool(n)?(this.options.drag.enabled=n,this):this.options.drag},LG={id:"actions/drag",install:bjn,listeners:{"interactions:before-action-move":eSe,"interactions:action-resume":eSe,"interactions:action-move":ect,"auto-start:check":n=>{const{interaction:e,interactable:t,buttons:i}=n,s=t.options.drag;if(!(!(s&&s.enabled)||e.pointerIsDown&&/mouse|pointer/.test(e.pointerType)&&(i&t.options.drag.mouseButtons)===0))return n.action={name:"drag",axis:s.lockAxis==="start"?s.startAxis:s.lockAxis},!1}},draggable:yjn,beforeMove:eSe,move:ect,defaults:{startAxis:"xy",lockAxis:"xy"},getCursor(){return"move"}},_jn=LG;p_.use(_jn);function wjn(n){const{actions:e,browser:t,Interactable:i,defaults:s}=n;m_.cursors=Ejn(t),m_.defaultMargin=t.supportsTouch||t.supportsPointerEvent?20:10,i.prototype.resizable=function(r){return vjn(this,r,n)},e.map.resize=m_,e.methodDict.resize="resizable",s.actions.resize=m_.defaults}function Cjn(n){const{interaction:e,interactable:t,element:i,rect:s,buttons:r}=n;if(!s)return;const o=In({},e.coords.cur.page),a=t.options.resize;if(!(!(a&&a.enabled)||e.pointerIsDown&&/mouse|pointer/.test(e.pointerType)&&(r&a.mouseButtons)===0)){if(ut.object(a.edges)){const l={left:!1,right:!1,top:!1,bottom:!1};for(const c in l)l[c]=Sjn(c,a.edges[c],o,e._latestPointer.eventTarget,i,s,a.margin||m_.defaultMargin);l.left=l.left&&!l.right,l.top=l.top&&!l.bottom,(l.left||l.right||l.top||l.bottom)&&(n.action={name:"resize",edges:l})}else{const l=a.axis!=="y"&&o.x>s.right-m_.defaultMargin,c=a.axis!=="x"&&o.y>s.bottom-m_.defaultMargin;(l||c)&&(n.action={name:"resize",axes:(l?"x":"")+(c?"y":"")})}return n.action?!1:void 0}}function vjn(n,e,t){return ut.object(e)?(n.options.resize.enabled=e.enabled!==!1,n.setPerAction("resize",e),n.setOnEvents("resize",e),ut.string(e.axis)&&/^x$|^y$|^xy$/.test(e.axis)?n.options.resize.axis=e.axis:e.axis===null&&(n.options.resize.axis=t.defaults.actions.resize.axis),ut.bool(e.preserveAspectRatio)?n.options.resize.preserveAspectRatio=e.preserveAspectRatio:ut.bool(e.square)&&(n.options.resize.square=e.square),n):ut.bool(e)?(n.options.resize.enabled=e,n):n.options.resize}function Sjn(n,e,t,i,s,r,o){if(!e)return!1;if(e===!0){const a=ut.number(r.width)?r.width:r.right-r.left,l=ut.number(r.height)?r.height:r.bottom-r.top;if(o=Math.min(o,Math.abs((n==="left"||n==="right"?a:l)/2)),a<0&&(n==="left"?n="right":n==="right"&&(n="left")),l<0&&(n==="top"?n="bottom":n==="bottom"&&(n="top")),n==="left"){const c=a>=0?r.left:r.right;return t.x<c+o}if(n==="top"){const c=l>=0?r.top:r.bottom;return t.y<c+o}if(n==="right")return t.x>(a>=0?r.right:r.left)-o;if(n==="bottom")return t.y>(l>=0?r.bottom:r.top)-o}return ut.element(i)?ut.element(e)?e===i:O1e(i,e,s):!1}function Ejn(n){return n.isIe9?{x:"e-resize",y:"s-resize",xy:"se-resize",top:"n-resize",left:"w-resize",bottom:"s-resize",right:"e-resize",topleft:"se-resize",bottomright:"se-resize",topright:"ne-resize",bottomleft:"ne-resize"}:{x:"ew-resize",y:"ns-resize",xy:"nwse-resize",top:"ns-resize",left:"ew-resize",bottom:"ns-resize",right:"ew-resize",topleft:"nwse-resize",bottomright:"nwse-resize",topright:"nesw-resize",bottomleft:"nesw-resize"}}function xjn({iEvent:n,interaction:e}){if(e.prepared.name!=="resize"||!e.prepared.edges)return;const t=n,i=e.rect;e._rects={start:In({},i),corrected:In({},i),previous:In({},i),delta:{left:0,right:0,width:0,top:0,bottom:0,height:0}},t.edges=e.prepared.edges,t.rect=e._rects.corrected,t.deltaRect=e._rects.delta}function kjn({iEvent:n,interaction:e}){if(e.prepared.name!=="resize"||!e.prepared.edges)return;const t=n,i=e.interactable.options.resize.invert,s=i==="reposition"||i==="negate",r=e.rect,{start:o,corrected:a,delta:l,previous:c}=e._rects;if(In(c,a),s){if(In(a,r),i==="reposition"){if(a.top>a.bottom){const d=a.top;a.top=a.bottom,a.bottom=d}if(a.left>a.right){const d=a.left;a.left=a.right,a.right=d}}}else a.top=Math.min(r.top,o.bottom),a.bottom=Math.max(r.bottom,o.top),a.left=Math.min(r.left,o.right),a.right=Math.max(r.right,o.left);a.width=a.right-a.left,a.height=a.bottom-a.top;for(const d in a)l[d]=a[d]-c[d];t.edges=e.prepared.edges,t.rect=a,t.deltaRect=l}function Tjn({iEvent:n,interaction:e}){if(e.prepared.name!=="resize"||!e.prepared.edges)return;const t=n;t.edges=e.prepared.edges,t.rect=e._rects.corrected,t.deltaRect=e._rects.delta}function tct({iEvent:n,interaction:e}){if(e.prepared.name!=="resize"||!e.resizeAxes)return;const t=e.interactable.options,i=n;t.resize.square?(e.resizeAxes==="y"?i.delta.x=i.delta.y:i.delta.y=i.delta.x,i.axes="xy"):(i.axes=e.resizeAxes,e.resizeAxes==="x"?i.delta.y=0:e.resizeAxes==="y"&&(i.delta.x=0))}const m_={id:"actions/resize",before:["actions/drag"],install:wjn,listeners:{"interactions:new":({interaction:n})=>{n.resizeAxes="xy"},"interactions:action-start":n=>{xjn(n),tct(n)},"interactions:action-move":n=>{kjn(n),tct(n)},"interactions:action-end":Tjn,"auto-start:check":Cjn},defaults:{square:!1,preserveAspectRatio:!1,axis:"xy",margin:NaN,edges:null,invert:"none"},cursors:null,getCursor({edges:n,axis:e,name:t}){const i=m_.cursors;let s=null;if(e)s=i[t+e];else if(n){let r="";for(const o of["top","bottom","left","right"])n[o]&&(r+=o);s=i[r]}return s},defaultMargin:null},Ljn=m_;p_.use(Ljn);const Ijn=()=>{},Djn=()=>{},Njn=n=>{const e=[["x","y"],["left","top"],["right","bottom"],["width","height"]].filter(([i,s])=>i in n||s in n),t=(i,s)=>{const{range:r,limits:o={left:-1/0,right:1/0,top:-1/0,bottom:1/0},offset:a={x:0,y:0}}=n,l={range:r,grid:n,x:null,y:null};for(const[c,d]of e){const u=Math.round((i-a.x)/n[c]),f=Math.round((s-a.y)/n[d]);l[c]=Math.max(o.left,Math.min(o.right,u*n[c]+a.x)),l[d]=Math.max(o.top,Math.min(o.bottom,f*n[d]+a.y))}return l};return t.grid=n,t.coordFields=e,t},Rjn=Object.freeze(Object.defineProperty({__proto__:null,edgeTarget:Ijn,elements:Djn,grid:Njn},Symbol.toStringTag,{value:"Module"})),Mjn={id:"snappers",install(n){const{interactStatic:e}=n;e.snappers=In(e.snappers||{},Rjn),e.createSnapGrid=e.snappers.grid}},Bjn=Mjn;class nct{constructor(e){at(this,"states",[]),at(this,"startOffset",{left:0,right:0,top:0,bottom:0}),at(this,"startDelta"),at(this,"result"),at(this,"endResult"),at(this,"startEdges"),at(this,"edges"),at(this,"interaction"),this.interaction=e,this.result=IG(),this.edges={left:!1,right:!1,top:!1,bottom:!1}}start({phase:e},t){const{interaction:i}=this,s=Fjn(i);this.prepareStates(s),this.startEdges=In({},i.edges),this.edges=In({},this.startEdges),this.startOffset=Ojn(i.rect,t),this.startDelta={x:0,y:0};const r=this.fillArg({phase:e,pageCoords:t,preEnd:!1});return this.result=IG(),this.startAll(r),this.result=this.setAll(r)}fillArg(e){const{interaction:t}=this;return e.interaction=t,e.interactable=t.interactable,e.element=t.element,e.rect||(e.rect=t.rect),e.edges||(e.edges=this.startEdges),e.startOffset=this.startOffset,e}startAll(e){for(const t of this.states)t.methods.start&&(e.state=t,t.methods.start(e))}setAll(e){const{phase:t,preEnd:i,skipModifiers:s,rect:r,edges:o}=e;e.coords=In({},e.pageCoords),e.rect=In({},r),e.edges=In({},o);const a=s?this.states.slice(s):this.states,l=IG(e.coords,e.rect);for(const f of a){var c;const{options:g}=f,p=In({},e.coords);let m=null;(c=f.methods)!=null&&c.set&&this.shouldDo(g,i,t)&&(e.state=f,m=f.methods.set(e),z1e(e.edges,e.rect,{x:e.coords.x-p.x,y:e.coords.y-p.y})),l.eventProps.push(m)}In(this.edges,e.edges),l.delta.x=e.coords.x-e.pageCoords.x,l.delta.y=e.coords.y-e.pageCoords.y,l.rectDelta.left=e.rect.left-r.left,l.rectDelta.right=e.rect.right-r.right,l.rectDelta.top=e.rect.top-r.top,l.rectDelta.bottom=e.rect.bottom-r.bottom;const d=this.result.coords,u=this.result.rect;if(d&&u){const f=l.rect.left!==u.left||l.rect.right!==u.right||l.rect.top!==u.top||l.rect.bottom!==u.bottom;l.changed=f||d.x!==l.coords.x||d.y!==l.coords.y}return l}applyToInteraction(e){const{interaction:t}=this,{phase:i}=e,s=t.coords.cur,r=t.coords.start,{result:o,startDelta:a}=this,l=o.delta;i==="start"&&In(this.startDelta,o.delta);for(const[u,f]of[[r,a],[s,l]])u.page.x+=f.x,u.page.y+=f.y,u.client.x+=f.x,u.client.y+=f.y;const{rectDelta:c}=this.result,d=e.rect||t.rect;d.left+=c.left,d.right+=c.right,d.top+=c.top,d.bottom+=c.bottom,d.width=d.right-d.left,d.height=d.bottom-d.top}setAndApply(e){const{interaction:t}=this,{phase:i,preEnd:s,skipModifiers:r}=e,o=this.setAll(this.fillArg({preEnd:s,phase:i,pageCoords:e.modifiedCoords||t.coords.cur.page}));if(this.result=o,!o.changed&&(!r||r<this.states.length)&&t.interacting())return!1;if(e.modifiedCoords){const{page:a}=t.coords.cur,l={x:e.modifiedCoords.x-a.x,y:e.modifiedCoords.y-a.y};o.coords.x+=l.x,o.coords.y+=l.y,o.delta.x+=l.x,o.delta.y+=l.y}this.applyToInteraction(e)}beforeEnd(e){const{interaction:t,event:i}=e,s=this.states;if(!s||!s.length)return;let r=!1;for(const o of s){e.state=o;const{options:a,methods:l}=o,c=l.beforeEnd&&l.beforeEnd(e);if(c)return this.endResult=c,!1;r=r||!r&&this.shouldDo(a,!0,e.phase,!0)}r&&t.move({event:i,preEnd:!0})}stop(e){const{interaction:t}=e;if(!this.states||!this.states.length)return;const i=In({states:this.states,interactable:t.interactable,element:t.element,rect:null},e);this.fillArg(i);for(const s of this.states)i.state=s,s.methods.stop&&s.methods.stop(i);this.states=null,this.endResult=null}prepareStates(e){this.states=[];for(let t=0;t<e.length;t++){const{options:i,methods:s,name:r}=e[t];this.states.push({options:i,methods:s,index:t,name:r})}return this.states}restoreInteractionCoords({interaction:{coords:e,rect:t,modification:i}}){if(!i.result)return;const{startDelta:s}=i,{delta:r,rectDelta:o}=i.result,a=[[e.start,s],[e.cur,r]];for(const[l,c]of a)l.page.x-=c.x,l.page.y-=c.y,l.client.x-=c.x,l.client.y-=c.y;t.left-=o.left,t.right-=o.right,t.top-=o.top,t.bottom-=o.bottom}shouldDo(e,t,i,s){return!(!e||e.enabled===!1||s&&!e.endOnly||e.endOnly&&!t||i==="start"&&!e.setStart)}copyFrom(e){this.startOffset=e.startOffset,this.startDelta=e.startDelta,this.startEdges=e.startEdges,this.edges=e.edges,this.states=e.states.map(t=>oR(t)),this.result=IG(In({},e.result.coords),In({},e.result.rect))}destroy(){for(const e in this)this[e]=null}}function IG(n,e){return{rect:e,coords:n,delta:{x:0,y:0},rectDelta:{left:0,right:0,top:0,bottom:0},eventProps:[],changed:!0}}function Fjn(n){const e=n.interactable.options[n.prepared.name],t=e.modifiers;return t&&t.length?t:["snap","snapSize","snapEdges","restrict","restrictEdges","restrictSize"].map(i=>{const s=e[i];return s&&s.enabled&&{options:s,methods:s._methods}}).filter(i=>!!i)}function Ojn(n,e){return n?{left:e.x-n.left,top:e.y-n.top,right:n.right-e.x,bottom:n.bottom-e.y}:{left:0,top:0,right:0,bottom:0}}function D0(n,e){const{defaults:t}=n,i={start:n.start,set:n.set,beforeEnd:n.beforeEnd,stop:n.stop},s=r=>{const o=r||{};o.enabled=o.enabled!==!1;for(const l in t)l in o||(o[l]=t[l]);const a={options:o,methods:i,name:e,enable:()=>(o.enabled=!0,a),disable:()=>(o.enabled=!1,a)};return a};return e&&typeof e=="string"&&(s._defaults=t,s._methods=i),s}function tSe({iEvent:n,interaction:e}){const t=e.modification.result;t&&(n.modifiers=t.eventProps)}const Pjn={id:"modifiers/base",before:["actions"],install:n=>{n.defaults.perAction.modifiers=[]},listeners:{"interactions:new":({interaction:n})=>{n.modification=new nct(n)},"interactions:before-action-start":n=>{const{interaction:e}=n,t=n.interaction.modification;t.start(n,e.coords.start.page),e.edges=t.edges,t.applyToInteraction(n)},"interactions:before-action-move":n=>{const{interaction:e}=n,{modification:t}=e,i=t.setAndApply(n);return e.edges=t.edges,i},"interactions:before-action-end":n=>{const{interaction:e}=n,{modification:t}=e,i=t.beforeEnd(n);return e.edges=t.startEdges,i},"interactions:action-start":tSe,"interactions:action-move":tSe,"interactions:action-end":tSe,"interactions:after-action-start":n=>n.interaction.modification.restoreInteractionCoords(n),"interactions:after-action-move":n=>n.interaction.modification.restoreInteractionCoords(n),"interactions:stop":n=>n.interaction.modification.stop(n)}},Vjn=Pjn,Ujn={start(n){const{state:e,rect:t,edges:i,pageCoords:s}=n;let{ratio:r,enabled:o}=e.options;const{equalDelta:a,modifiers:l}=e.options;r==="preserve"&&(r=t.width/t.height),e.startCoords=In({},s),e.startRect=In({},t),e.ratio=r,e.equalDelta=a;const c=e.linkedEdges={top:i.top||i.left&&!i.bottom,left:i.left||i.top&&!i.right,bottom:i.bottom||i.right&&!i.top,right:i.right||i.bottom&&!i.left};if(e.xIsPrimaryAxis=!!(i.left||i.right),e.equalDelta){const u=(c.left?1:-1)*(c.top?1:-1);e.edgeSign={x:u,y:u}}else e.edgeSign={x:c.left?-1:1,y:c.top?-1:1};if(o!==!1&&In(i,c),!(l!=null&&l.length))return;const d=new nct(n.interaction);d.copyFrom(n.interaction.modification),d.prepareStates(l),e.subModification=d,d.startAll({...n})},set(n){const{state:e,rect:t,coords:i}=n,{linkedEdges:s}=e,r=In({},i),o=e.equalDelta?Hjn:$jn;if(In(n.edges,s),o(e,e.xIsPrimaryAxis,i,t),!e.subModification)return null;const a=In({},t);z1e(s,a,{x:i.x-r.x,y:i.y-r.y});const l=e.subModification.setAll({...n,rect:a,edges:s,pageCoords:i,prevCoords:i,prevRect:a}),{delta:c}=l;if(l.changed){const d=Math.abs(c.x)>Math.abs(c.y);o(e,d,l.coords,l.rect),In(i,l.coords)}return l.eventProps},defaults:{ratio:"preserve",equalDelta:!1,modifiers:[],enabled:!1}};function Hjn({startCoords:n,edgeSign:e},t,i){t?i.y=n.y+(i.x-n.x)*e.y:i.x=n.x+(i.y-n.y)*e.x}function $jn({startRect:n,startCoords:e,ratio:t,edgeSign:i},s,r,o){if(s){const a=o.width/t;r.y=e.y+(a-n.height)*i.y}else{const a=o.height*t;r.x=e.x+(a-n.width)*i.x}}const Wjn=D0(Ujn,"aspectRatio"),ict=()=>{};ict._defaults={};const DG=ict;function zjn({rect:n,startOffset:e,state:t,interaction:i,pageCoords:s}){const{options:r}=t,{elementRect:o}=r,a=In({left:0,top:0,right:0,bottom:0},r.offset||{});if(n&&o){const l=cx(r.restriction,i,s);if(l){const c=l.right-l.left-n.width,d=l.bottom-l.top-n.height;c<0&&(a.left+=c,a.right+=c),d<0&&(a.top+=d,a.bottom+=d)}a.left+=e.left-n.width*o.left,a.top+=e.top-n.height*o.top,a.right+=e.right-n.width*(1-o.right),a.bottom+=e.bottom-n.height*(1-o.bottom)}t.offset=a}function Qjn({coords:n,interaction:e,state:t}){const{options:i,offset:s}=t,r=cx(i.restriction,e,n);if(!r)return;const o=BKn(r);n.x=Math.max(Math.min(o.right-s.right,n.x),o.left+s.left),n.y=Math.max(Math.min(o.bottom-s.bottom,n.y),o.top+s.top)}function cx(n,e,t){return ut.func(n)?tV(n,e.interactable,e.element,[t.x,t.y,e]):tV(n,e.interactable,e.element)}const qjn={restriction:null,elementRect:null,offset:null,endOnly:!1,enabled:!1},NG={start:zjn,set:Qjn,defaults:qjn},Kjn=D0(NG,"restrict"),sct={top:1/0,left:1/0,bottom:-1/0,right:-1/0},rct={top:-1/0,left:-1/0,bottom:1/0,right:1/0};function jjn({interaction:n,startOffset:e,state:t}){const{options:i}=t;let s;if(i){const r=cx(i.offset,n,n.coords.start.page);s=EG(r)}s=s||{x:0,y:0},t.offset={top:s.y+e.top,left:s.x+e.left,bottom:s.y-e.bottom,right:s.x-e.right}}function Gjn({coords:n,edges:e,interaction:t,state:i}){const{offset:s,options:r}=i;if(!e)return;const o=In({},n),a=cx(r.inner,t,o)||{},l=cx(r.outer,t,o)||{};oct(a,sct),oct(l,rct),e.top?n.y=Math.min(Math.max(l.top+s.top,o.y),a.top+s.top):e.bottom&&(n.y=Math.max(Math.min(l.bottom+s.bottom,o.y),a.bottom+s.bottom)),e.left?n.x=Math.min(Math.max(l.left+s.left,o.x),a.left+s.left):e.right&&(n.x=Math.max(Math.min(l.right+s.right,o.x),a.right+s.right))}function oct(n,e){for(const t of["top","left","bottom","right"])t in n||(n[t]=e[t]);return n}const Yjn={inner:null,outer:null,offset:null,endOnly:!1,enabled:!1},sV={noInner:sct,noOuter:rct,start:jjn,set:Gjn,defaults:Yjn},Xjn=D0(sV,"restrictEdges"),Zjn=In({get elementRect(){return{top:0,left:0,bottom:1,right:1}},set elementRect(n){}},NG.defaults),Jjn={start:NG.start,set:NG.set,defaults:Zjn},eGn=D0(Jjn,"restrictRect"),tGn={width:-1/0,height:-1/0},nGn={width:1/0,height:1/0};function iGn(n){return sV.start(n)}function sGn(n){const{interaction:e,state:t,rect:i,edges:s}=n,{options:r}=t;if(!s)return;const o=Vlt(cx(r.min,e,n.coords))||tGn,a=Vlt(cx(r.max,e,n.coords))||nGn;t.options={endOnly:r.endOnly,inner:In({},sV.noInner),outer:In({},sV.noOuter)},s.top?(t.options.inner.top=i.bottom-o.height,t.options.outer.top=i.bottom-a.height):s.bottom&&(t.options.inner.bottom=i.top+o.height,t.options.outer.bottom=i.top+a.height),s.left?(t.options.inner.left=i.right-o.width,t.options.outer.left=i.right-a.width):s.right&&(t.options.inner.right=i.left+o.width,t.options.outer.right=i.left+a.width),sV.set(n),t.options=r}const rGn={min:null,max:null,endOnly:!1,enabled:!1},oGn={start:iGn,set:sGn,defaults:rGn},aGn=D0(oGn,"restrictSize");function lGn(n){const{interaction:e,interactable:t,element:i,rect:s,state:r,startOffset:o}=n,{options:a}=r,l=a.offsetWithOrigin?dGn(n):{x:0,y:0};let c;if(a.offset==="startCoords")c={x:e.coords.start.page.x,y:e.coords.start.page.y};else{const u=tV(a.offset,t,i,[e]);c=EG(u)||{x:0,y:0},c.x+=l.x,c.y+=l.y}const{relativePoints:d}=a;r.offsets=s&&d&&d.length?d.map((u,f)=>({index:f,relativePoint:u,x:o.left-s.width*u.x+c.x,y:o.top-s.height*u.y+c.y})):[{index:0,relativePoint:null,x:c.x,y:c.y}]}function cGn(n){const{interaction:e,coords:t,state:i}=n,{options:s,offsets:r}=i,o=Q1e(e.interactable,e.element,e.prepared.name),a=In({},t),l=[];s.offsetWithOrigin||(a.x-=o.x,a.y-=o.y);for(const d of r){const u=a.x-d.x,f=a.y-d.y;for(let g=0,p=s.targets.length;g<p;g++){const m=s.targets[g];let A;ut.func(m)?A=m(u,f,e._proxy,d,g):A=m,A&&l.push({x:(ut.number(A.x)?A.x:u)+d.x,y:(ut.number(A.y)?A.y:f)+d.y,range:ut.number(A.range)?A.range:s.range,source:m,index:g,offset:d})}}const c={target:null,inRange:!1,distance:0,range:0,delta:{x:0,y:0}};for(const d of l){const u=d.range,f=d.x-a.x,g=d.y-a.y,p=xG(f,g);let m=p<=u;u===1/0&&c.inRange&&c.range!==1/0&&(m=!1),(!c.target||(m?c.inRange&&u!==1/0?p/u<c.distance/c.range:u===1/0&&c.range!==1/0||p<c.distance:!c.inRange&&p<c.distance))&&(c.target=d,c.distance=p,c.range=u,c.inRange=m,c.delta.x=f,c.delta.y=g)}return c.inRange&&(t.x=c.target.x,t.y=c.target.y),i.closest=c,c}function dGn(n){const{element:e}=n.interaction;return EG(tV(n.state.options.origin,null,null,[e]))||Q1e(n.interactable,e,n.interaction.prepared.name)}const uGn={range:1/0,targets:null,offset:null,offsetWithOrigin:!0,origin:null,relativePoints:null,endOnly:!1,enabled:!1},nSe={start:lGn,set:cGn,defaults:uGn},hGn=D0(nSe,"snap");function fGn(n){const{state:e,edges:t}=n,{options:i}=e;if(!t)return null;n.state={options:{targets:null,relativePoints:[{x:t.left?0:1,y:t.top?0:1}],offset:i.offset||"self",origin:{x:0,y:0},range:i.range}},e.targetFields=e.targetFields||[["width","height"],["x","y"]],nSe.start(n),e.offsets=n.state.offsets,n.state=e}function gGn(n){const{interaction:e,state:t,coords:i}=n,{options:s,offsets:r}=t,o={x:i.x-r[0].x,y:i.y-r[0].y};t.options=In({},s),t.options.targets=[];for(const l of s.targets||[]){let c;if(ut.func(l)?c=l(o.x,o.y,e):c=l,!!c){for(const[d,u]of t.targetFields)if(d in c||u in c){c.x=c[d],c.y=c[u];break}t.options.targets.push(c)}}const a=nSe.set(n);return t.options=s,a}const pGn={range:1/0,targets:null,offset:null,endOnly:!1,enabled:!1},RG={start:fGn,set:gGn,defaults:pGn},mGn=D0(RG,"snapSize");function AGn(n){const{edges:e}=n;return e?(n.state.targetFields=n.state.targetFields||[[e.left?"left":"right",e.top?"top":"bottom"]],RG.start(n)):null}const bGn={start:AGn,set:RG.set,defaults:In(oR(RG.defaults),{targets:null,range:null,offset:{x:0,y:0}})},yGn=D0(bGn,"snapEdges"),iSe={aspectRatio:Wjn,restrictEdges:Xjn,restrict:Kjn,restrictRect:eGn,restrictSize:aGn,snapEdges:yGn,snap:hGn,snapSize:mGn,spring:DG,avoid:DG,transform:DG,rubberband:DG},_Gn={id:"modifiers",install(n){const{interactStatic:e}=n;n.usePlugin(Vjn),n.usePlugin(Bjn),e.modifiers=iSe;for(const t in iSe){const{_defaults:i,_methods:s}=iSe[t];i._methods=s,n.defaults.perAction[t]=i}}},wGn=_Gn;p_.use(wGn);const CGn={};var cR;(function(n){n.touchAction="touchAction",n.boxSizing="boxSizing",n.noListeners="noListeners"})(cR||(cR={}));const act="[interact.js] ",sSe={touchAction:"https://developer.mozilla.org/en-US/docs/Web/CSS/touch-action",boxSizing:"https://developer.mozilla.org/en-US/docs/Web/CSS/box-sizing"};function vGn(n,{logger:e}={}){const{Interactable:t,defaults:i}=n;n.logger=e||console,i.base.devTools={ignore:{}},t.prototype.devTools=function(s){return s?(In(this.options.devTools,s),this):this.options.devTools},n.usePlugin(CGn)}const lct=[{name:cR.touchAction,perform({element:n}){return!SGn(n,"touchAction",/pan-|pinch|none/)},getInfo({element:n}){return[n,sSe.touchAction]},text:`Consider adding CSS "touch-action: none" to this element
2904
+ statistics about usage in the studio, such as feature usage. No uniquely identifying information is collected, though the system type, browser, screensize and country are recorded. You can disable telemetry in the settings menu.`)])]),OQn],PQn=h.defineComponent({name:"ResultsView",components:{LoadingView:BS,ResultsContainer:yve,HintComponent:U8e,LLMEditorRefinement:lUn},props:{editorData:{type:Object,required:!0},containerHeight:{type:Number,default:0},canOpenChat:{type:Boolean,default:!1},runEditorQuery:{type:Function,default:void 0}},emits:["llm-query-accepted","drilldown-click","refresh-click","content-change","open-chat"],setup(){const n=h.inject("connectionStore");if(!n)throw new Error("Requires injection of connection store");const e=h.ref(null),t=h.ref(null),i=h.ref(.5),s=h.ref(!1);return{connectionStore:n,splitViewRef:e,resultsContainerRef:t,splitRatio:i,isDragging:s,minPaneWidth:200}},computed:{hasActiveChat(){return this.editorData.hasActiveRefinement()},hasResults(){return this.editorData.results.headers&&this.editorData.results.headers.size>0||!!this.editorData.error},resultsPaneWidth(){return`calc(${this.splitRatio*100}% - 4px)`},chatPaneWidth(){return`calc(${(1-this.splitRatio)*100}% - 4px)`}},methods:{handleAccept(n){this.$emit("llm-query-accepted")},handleDiscard(){},handleContentChange(n,e){this.editorData.setContent(n),this.$emit("content-change",n)},handleChartConfigChange(n){var e;this.editorData.setChartConfig(n),(e=this.resultsContainerRef)==null||e.switchToVisualizeTab()},handleDrilldown(n){this.$emit("drilldown-click",n)},handleOpenChat(){this.$emit("open-chat")},async handleRunEditorQuery(){if(!this.runEditorQuery)return{success:!1,error:"Run editor query is not available"};const n=await this.runEditorQuery();if(!n)return{success:!1,error:"Query execution returned no result"};const e=n.results?[...n.results.headers.keys()].map(t=>String(t)):[];return{success:n.success,results:n.results?{headers:e,data:n.results.data}:void 0,error:n.error,executionTime:n.executionTime,resultSize:n.resultSize,columnCount:n.columnCount,generatedSql:n.generatedSql}},startDragging(n){n.preventDefault(),this.isDragging=!0,document.addEventListener("mousemove",this.onDrag),document.addEventListener("mouseup",this.stopDragging),document.body.style.cursor="col-resize",document.body.style.userSelect="none"},onDrag(n){if(!this.isDragging||!this.splitViewRef)return;const t=this.splitViewRef.getBoundingClientRect(),i=t.width;let r=(n.clientX-t.left)/i;const o=this.minPaneWidth/i,a=1-o;r=Math.max(o,Math.min(a,r)),this.splitRatio=r},stopDragging(){this.isDragging=!1,document.removeEventListener("mousemove",this.onDrag),document.removeEventListener("mouseup",this.stopDragging),document.body.style.cursor="",document.body.style.userSelect=""}},beforeUnmount(){document.removeEventListener("mousemove",this.onDrag),document.removeEventListener("mouseup",this.stopDragging)}}),VQn={class:"results-view"},UQn={key:0,class:"split-view",ref:"splitViewRef"};function HQn(n,e,t,i,s,r){const o=h.resolveComponent("loading-view"),a=h.resolveComponent("results-container"),l=h.resolveComponent("hint-component"),c=h.resolveComponent("LLMEditorRefinement");return h.openBlock(),h.createElementBlock("div",VQn,[n.hasActiveChat?(h.openBlock(),h.createElementBlock("div",UQn,[h.createElementVNode("div",{class:"results-pane",style:h.normalizeStyle({width:n.resultsPaneWidth})},[n.editorData.loading?(h.openBlock(),h.createBlock(o,{key:0,startTime:n.editorData.startTime,cancel:n.editorData.cancelCallback},null,8,["startTime","cancel"])):n.hasResults?(h.openBlock(),h.createBlock(a,{key:1,ref:"resultsContainerRef",results:n.editorData.results,generatedSql:n.editorData.generated_sql||void 0,trilogySource:n.editorData.executed_contents||void 0,containerHeight:n.containerHeight,type:n.editorData.type,chartConfig:n.editorData.chartConfig,error:n.editorData.error||void 0,symbols:n.editorData.completionSymbols,showChatButton:!1,onConfigChange:e[0]||(e[0]=d=>n.editorData.setChartConfig(d)),onDrilldownClick:n.handleDrilldown,onRefreshClick:e[1]||(e[1]=()=>n.$emit("refresh-click"))},null,8,["results","generatedSql","trilogySource","containerHeight","type","chartConfig","error","symbols","onDrilldownClick"])):(h.openBlock(),h.createBlock(l,{key:2}))],4),h.createElementVNode("div",{class:"divider",onMousedown:e[2]||(e[2]=(...d)=>n.startDragging&&n.startDragging(...d))},[...e[5]||(e[5]=[h.createElementVNode("div",{class:"divider-handle"},null,-1)])],32),h.createElementVNode("div",{class:"chat-pane",style:h.normalizeStyle({width:n.chatPaneWidth})},[h.createVNode(c,{editorId:n.editorData.id,runEditorQuery:n.handleRunEditorQuery,onAccept:n.handleAccept,onDiscard:n.handleDiscard,onContentChange:n.handleContentChange,onChartConfigChange:n.handleChartConfigChange},null,8,["editorId","runEditorQuery","onAccept","onDiscard","onContentChange","onChartConfigChange"])],4)],512)):(h.openBlock(),h.createElementBlock(h.Fragment,{key:1},[n.editorData.loading?(h.openBlock(),h.createBlock(o,{key:0,startTime:n.editorData.startTime,cancel:n.editorData.cancelCallback},null,8,["startTime","cancel"])):n.hasResults?(h.openBlock(),h.createBlock(a,{key:1,results:n.editorData.results,generatedSql:n.editorData.generated_sql||void 0,trilogySource:n.editorData.executed_contents||void 0,containerHeight:n.containerHeight,type:n.editorData.type,chartConfig:n.editorData.chartConfig,error:n.editorData.error||void 0,symbols:n.editorData.completionSymbols,showChatButton:n.canOpenChat,onConfigChange:e[3]||(e[3]=d=>n.editorData.setChartConfig(d)),onDrilldownClick:n.handleDrilldown,onRefreshClick:e[4]||(e[4]=()=>n.$emit("refresh-click")),onOpenChat:n.handleOpenChat},null,8,["results","generatedSql","trilogySource","containerHeight","type","chartConfig","error","symbols","showChatButton","onDrilldownClick","onOpenChat"])):(h.openBlock(),h.createBlock(l,{key:2}))],64))])}const R1e=tt(PQn,[["render",HQn],["__scopeId","data-v-0dbf2ac6"]]),olt=Object.freeze(Object.defineProperty({__proto__:null,default:R1e},Symbol.toStringTag,{value:"Module"})),$Qn=h.defineComponent({name:"LLMProviderIcon",props:{providerType:{type:String,required:!0}}}),WQn={class:"provider-icon-container"},zQn={key:0,class:"mdi mdi-alpha-c-circle",title:"Anthropic"},QQn={key:1,class:"mdi mdi-flash",title:"OpenAI"},qQn={key:2,class:"mdi mdi-google",title:"Google"},KQn={key:3,class:"mdi mdi-robot",title:"LLM Provider"};function jQn(n,e,t,i,s,r){return h.openBlock(),h.createElementBlock("div",WQn,[n.providerType==="anthropic"?(h.openBlock(),h.createElementBlock("i",zQn)):n.providerType==="openai"?(h.openBlock(),h.createElementBlock("i",QQn)):n.providerType==="google"?(h.openBlock(),h.createElementBlock("i",qQn)):(h.openBlock(),h.createElementBlock("i",KQn))])}const GQn=tt($Qn,[["render",jQn],["__scopeId","data-v-e96cf50b"]]),YQn=h.defineComponent({name:"ContextMenu",props:{items:{type:Array,required:!0},position:{type:Object,default:()=>({x:0,y:0})},isVisible:{type:Boolean,default:!1},id:{type:String,default:""}},emits:["item-click","close"],setup(n,{emit:e}){const t=h.computed(()=>({left:`${n.position.x}px`,top:`${n.position.y}px`})),i=r=>{e("item-click",r),e("close")},s=r=>{n.isVisible&&e("close")};return h.onMounted(()=>{setTimeout(()=>{document.addEventListener("click",s)},300)}),h.onUnmounted(()=>{document.removeEventListener("click",s)}),{positionStyle:t,handleItemClick:i}}}),XQn=["onClick"];function ZQn(n,e,t,i,s,r){return n.isVisible?(h.openBlock(),h.createElementBlock("div",{key:0,style:h.normalizeStyle(n.positionStyle),class:"context-menu"},[(h.openBlock(!0),h.createElementBlock(h.Fragment,null,h.renderList(n.items,o=>(h.openBlock(),h.createElementBlock("div",{key:o.id,class:h.normalizeClass(["context-menu-item",{danger:o.danger}]),onClick:a=>n.handleItemClick(o)},[o.icon?(h.openBlock(),h.createElementBlock("i",{key:0,class:h.normalizeClass(`mdi ${o.icon}`)},null,2)):h.createCommentVNode("",!0),h.createElementVNode("span",null,h.toDisplayString(o.label),1)],10,XQn))),128))],4)):h.createCommentVNode("",!0)}const JQn=tt(YQn,[["render",ZQn],["__scopeId","data-v-48938153"]]),eqn=h.defineComponent({name:"LLMConnectionListItem",components:{SidebarItem:NS,LLMProviderIcon:GQn,ConnectionRefresh:slt,ConnectionStatusIcon:dge,LoadingButton:ya,ContextMenu:JQn,Tooltip:ko},props:{item:{type:Object,required:!0},isCollapsed:{type:Boolean,default:!0},isSelected:{type:Boolean,default:!1}},emits:["toggle","setActive","refresh","updateApiKey","updateModel","updateFastModel","toggleSaveCredential","deleteConnection","deleteChat"],setup(n,{emit:e}){const t=h.ref(""),i=h.ref(!1),s=h.ref(""),r=h.ref("");h.onMounted(()=>{var I,D,N;n.item.type==="api-key"&&((I=n.item.connection)!=null&&I.getApiKey())&&(t.value=n.item.connection.getApiKey()),n.item.type==="model"&&((D=n.item.connection)!=null&&D.model)&&(s.value=n.item.connection.model),n.item.type==="fast-model"&&(r.value=((N=n.item.connection)==null?void 0:N.fastModel)||"")}),h.watch(()=>{var I;return(I=n.item.connection)==null?void 0:I.apiKey},I=>{n.item.type==="api-key"&&I&&(t.value=I)}),h.watch(()=>{var I;return(I=n.item.connection)==null?void 0:I.model},I=>{n.item.type==="model"&&I&&(s.value=I)},{immediate:!0}),h.watch(()=>{var I;return(I=n.item.connection)==null?void 0:I.fastModel},I=>{n.item.type==="fast-model"&&(r.value=I||"")},{immediate:!0});const o=h.ref(!1),a=h.ref({x:0,y:0}),l=h.computed(()=>{const I=[];return n.item.type==="connection"&&I.push({id:"set-default",label:"Set as Default",icon:"mdi-star-outline"},{id:"refresh",label:"Refresh Connection",icon:"mdi-refresh"},{id:"delete",label:"Delete Connection",icon:"mdi-delete-outline",danger:!0}),I}),c=I=>{n.item.type==="connection"&&(a.value={x:I.clientX,y:I.clientY},o.value=!0)},d=I=>{var D;switch(I.id){case"delete":w(n.item.id);break;case"set-default":_(n.item.id);break;case"refresh":e("refresh",n.item.id,((D=n.item.connection)==null?void 0:D.name)||"","connection");break}},u=h.computed(()=>["connection"].includes(n.item.type)),f=()=>["api-key","model","fast-model","toggle-save-credential","refresh-connection"].includes(n.item.type)?"":n.item.name,g=()=>{(u.value||n.item.type==="open-chat"||n.item.type==="open-validation"||n.item.type==="new-chat"||n.item.type==="chat-item")&&p(n.item.id)},p=I=>{var N;const D=n.item.type==="chat-item"?{chatId:n.item.chatId}:void 0;e("toggle",I,((N=n.item.connection)==null?void 0:N.name)||"",n.item.type,D)},m=I=>{var D;I.stopPropagation(),e("refresh",n.item.id,((D=n.item.connection)==null?void 0:D.name)||"","connection")},A=I=>{e("toggleSaveCredential",I)},b=I=>I instanceof Rv?"anthropic":I instanceof ew?"openai":I instanceof Mv?"google":"unknown",y=I=>I&&I.connected===!0,_=I=>{var D;e("setActive",I,((D=n.item.connection)==null?void 0:D.name)||"","connection")},w=I=>{var D;e("deleteConnection",I,((D=n.item.connection)==null?void 0:D.name)||"")};return{apiKeyInput:t,selectedModel:s,selectedFastModel:r,isExpandable:u,getItemName:f,handleItemClick:g,handleRefreshConnectionClick:m,getProviderType:b,isConnected:y,setAsActive:_,updateApiKey:(I,D)=>{e("updateApiKey",I,D)},updateModel:(I,D)=>{e("updateModel",I,D)},updateFastModel:(I,D)=>{e("updateFastModel",I,D)},toggleSaveCredential:A,deleteConnection:w,deleteChat:I=>{var D;I&&e("deleteChat",I,((D=n.item.connection)==null?void 0:D.name)||"")},contextMenuVisible:o,contextMenuPosition:a,contextMenuItems:l,showContextMenu:c,handleContextMenuItemClick:d,toggleCollapse:p,showApiKey:i,toggleApiKeyVisibility:()=>{i.value=!i.value}}}}),tqn={key:1,class:"mdi mdi-alert-circle node-icon"},nqn={key:2,class:"mdi mdi-chat-outline node-icon"},iqn={key:3,class:"mdi mdi-test-tube node-icon"},sqn={key:4,class:"mdi mdi-chat-plus-outline node-icon"},rqn={key:5,class:"mdi mdi-chat node-icon"},oqn={key:6,class:"mdi mdi-folder-outline node-icon"},aqn={class:"api-key-input-wrapper"},lqn=["type","data-testid"],cqn=["data-testid","title"],dqn=["data-testid"],uqn=["data-testid"],hqn=["data-testid"],fqn=["value","data-testid"],gqn=["data-testid"],pqn=["data-testid"],mqn=["data-testid"],Aqn=["value","data-testid"],bqn={class:"save-credential-toggle"},yqn=["checked"],_qn={key:0},wqn={key:0,class:"chat-actions"},Cqn={key:1,class:"connection-actions"},vqn={key:0,class:"mdi mdi-star loading-button is-active"};function Sqn(n,e,t,i,s,r){const o=h.resolveComponent("context-menu"),a=h.resolveComponent("LLMProviderIcon"),l=h.resolveComponent("tooltip"),c=h.resolveComponent("LoadingButton"),d=h.resolveComponent("connection-refresh"),u=h.resolveComponent("connection-status-icon"),f=h.resolveComponent("sidebar-item");return h.openBlock(),h.createElementBlock("div",null,[h.createVNode(f,{"item-id":n.item.id,name:n.getItemName(),indent:n.item.indent,"is-selected":n.isSelected,"is-collapsible":n.isExpandable,"is-collapsed":n.isCollapsed,itemType:"llm-connection",onClick:n.handleItemClick,onToggle:n.toggleCollapse,onContextmenu:h.withModifiers(n.showContextMenu,["prevent"])},{icon:h.withCtx(()=>[n.item.type==="connection"?(h.openBlock(),h.createBlock(a,{key:0,"provider-type":n.getProviderType(n.item.connection)},null,8,["provider-type"])):n.item.type==="error"?(h.openBlock(),h.createElementBlock("i",tqn)):n.item.type==="open-chat"?(h.openBlock(),h.createElementBlock("i",nqn)):n.item.type==="open-validation"?(h.openBlock(),h.createElementBlock("i",iqn)):n.item.type==="new-chat"?(h.openBlock(),h.createElementBlock("i",sqn)):n.item.type==="chat-item"?(h.openBlock(),h.createElementBlock("i",rqn)):n.item.type==="chats-header"?(h.openBlock(),h.createElementBlock("i",oqn)):h.createCommentVNode("",!0)]),name:h.withCtx(()=>[n.item.type==="refresh-connection"?(h.openBlock(),h.createElementBlock("div",{key:0,class:"refresh title-pad-left truncate-text sidebar-sub-item",onClick:e[1]||(e[1]=(...g)=>n.handleRefreshConnectionClick&&n.handleRefreshConnectionClick(...g))},h.toDisplayString(n.item.name),1)):n.item.type==="api-key"?(h.openBlock(),h.createElementBlock("div",{key:1,class:"api-key-container",onClick:e[5]||(e[5]=h.withModifiers(()=>{},["stop"]))},[h.createElementVNode("form",{onSubmit:e[4]||(e[4]=h.withModifiers(g=>n.updateApiKey(n.item.connection,n.apiKeyInput),["prevent"]))},[e[17]||(e[17]=h.createElementVNode("button",{type:"submit",class:"customize-button"},"Update API Key",-1)),h.createElementVNode("div",aqn,[h.withDirectives(h.createElementVNode("input",{type:n.showApiKey?"text":"password",id:"api-key","onUpdate:modelValue":e[2]||(e[2]=g=>n.apiKeyInput=g),placeholder:"API Key",class:"connection-customize","data-testid":`api-key-input-${n.item.connection.name}`},null,8,lqn),[[h.vModelDynamic,n.apiKeyInput]]),h.createElementVNode("button",{type:"button",class:"visibility-toggle",onClick:e[3]||(e[3]=(...g)=>n.toggleApiKeyVisibility&&n.toggleApiKeyVisibility(...g)),"data-testid":`toggle-api-key-visibility-${n.item.connection.name}`,title:n.showApiKey?"Hide API Key":"Show API Key"},[h.createElementVNode("i",{class:h.normalizeClass(n.showApiKey?"mdi mdi-eye-off":"mdi mdi-eye")},null,2)],8,cqn)])],32)])):n.item.type==="model"?(h.openBlock(),h.createElementBlock("div",{key:2,class:"api-key-container",onClick:e[8]||(e[8]=h.withModifiers(()=>{},["stop"]))},[h.createElementVNode("form",{onSubmit:e[7]||(e[7]=h.withModifiers(g=>n.updateModel(n.item.connection,n.selectedModel),["prevent"])),"data-testid":`model-update-form-${n.item.connection.name}`},[h.createElementVNode("button",{type:"submit",class:"customize-button","data-testid":`update-model-${n.item.connection.name}`}," Update Model ",8,uqn),h.withDirectives(h.createElementVNode("select",{"onUpdate:modelValue":e[6]||(e[6]=g=>n.selectedModel=g),id:"connection-type",required:"",class:"connection-customize","data-testid":`model-select-${n.item.connection.name}`},[(h.openBlock(!0),h.createElementBlock(h.Fragment,null,h.renderList(n.item.connection.models,g=>(h.openBlock(),h.createElementBlock("option",{value:g,key:g,"data-testid":`model-option-${g}`},h.toDisplayString(g),9,fqn))),128))],8,hqn),[[h.vModelSelect,n.selectedModel]])],40,dqn)])):n.item.type==="fast-model"?(h.openBlock(),h.createElementBlock("div",{key:3,class:"api-key-container",onClick:e[11]||(e[11]=h.withModifiers(()=>{},["stop"]))},[h.createElementVNode("form",{onSubmit:e[10]||(e[10]=h.withModifiers(g=>n.updateFastModel(n.item.connection,n.selectedFastModel||null),["prevent"])),"data-testid":`fast-model-update-form-${n.item.connection.name}`},[h.createElementVNode("button",{type:"submit",class:"customize-button","data-testid":`update-fast-model-${n.item.connection.name}`}," Update Fast Model ",8,pqn),h.withDirectives(h.createElementVNode("select",{"onUpdate:modelValue":e[9]||(e[9]=g=>n.selectedFastModel=g),class:"connection-customize","data-testid":`fast-model-select-${n.item.connection.name}`},[e[18]||(e[18]=h.createElementVNode("option",{value:"","data-testid":"fast-model-option-none"},"(Use primary model)",-1)),(h.openBlock(!0),h.createElementBlock(h.Fragment,null,h.renderList(n.item.connection.models,g=>(h.openBlock(),h.createElementBlock("option",{value:g,key:g,"data-testid":`fast-model-option-${g}`},h.toDisplayString(g),9,Aqn))),128))],8,mqn),[[h.vModelSelect,n.selectedFastModel]])],40,gqn)])):n.item.type==="toggle-save-credential"?(h.openBlock(),h.createElementBlock("div",{key:4,class:"md-token-container",onClick:e[13]||(e[13]=h.withModifiers(()=>{},["stop"]))},[h.createElementVNode("label",bqn,[h.createElementVNode("input",{type:"checkbox",checked:n.item.connection.saveCredential,onChange:e[12]||(e[12]=g=>n.toggleSaveCredential(n.item.connection))},null,40,yqn),e[19]||(e[19]=h.createElementVNode("span",{class:"checkbox-label"},"Save Credentials",-1))])])):(h.openBlock(),h.createElementBlock("span",{key:5,class:h.normalizeClass(["title-pad-left truncate-text",{"error-indicator":n.item.type==="error"}])},[h.createTextVNode(h.toDisplayString(n.item.name)+" ",1),n.item.count!==void 0&&n.item.count>0?(h.openBlock(),h.createElementBlock("span",_qn," ("+h.toDisplayString(n.item.count)+") ",1)):h.createCommentVNode("",!0)],2))]),"extra-content":h.withCtx(()=>[n.item.type==="chat-item"?(h.openBlock(),h.createElementBlock("div",wqn,[h.createVNode(l,{class:"tactile-button",content:"Delete Chat",position:"left"},{default:h.withCtx(()=>[h.createElementVNode("span",{class:"remove-btn hover-icon",onClick:e[14]||(e[14]=h.withModifiers(g=>n.deleteChat(n.item.chatId),["stop"]))},[...e[20]||(e[20]=[h.createElementVNode("i",{class:"mdi mdi-trash-can-outline"},null,-1)])])]),_:1})])):h.createCommentVNode("",!0),n.item.type==="connection"?(h.openBlock(),h.createElementBlock("div",Cqn,[n.item.connection&&n.item.connection.isDefault?(h.openBlock(),h.createElementBlock("i",vqn)):(h.openBlock(),h.createBlock(c,{key:1,class:"loading-button",onClick:e[15]||(e[15]=h.withModifiers(()=>{},["stop"])),action:()=>n.setAsActive(n.item.id),title:"Set as default"},{default:h.withCtx(()=>[...e[21]||(e[21]=[h.createElementVNode("i",{class:"mdi mdi-star-outline"},null,-1)])]),_:1},8,["action"])),n.item.connection?(h.openBlock(),h.createBlock(d,{key:2,connection:n.item.connection,type:"llm","is-connected":n.isConnected(n.item.connection),"data-testid":`refresh-llm-connection-${n.item.connection.name}`},null,8,["connection","is-connected","data-testid"])):h.createCommentVNode("",!0),h.createVNode(l,{class:"tacticle-button",content:"Delete Connection",position:"left"},{default:h.withCtx(()=>[h.createElementVNode("span",{class:"remove-btn",onClick:e[16]||(e[16]=h.withModifiers(g=>n.deleteConnection(n.item.id),["stop"]))},[...e[22]||(e[22]=[h.createElementVNode("i",{class:"mdi mdi-trash-can-outline tactile-button"},null,-1)])])]),_:1}),n.item.connection?(h.openBlock(),h.createBlock(u,{key:3,connection:n.item.connection},null,8,["connection"])):h.createCommentVNode("",!0)])):h.createCommentVNode("",!0)]),default:h.withCtx(()=>[h.createVNode(o,{items:n.contextMenuItems,position:n.contextMenuPosition,"is-visible":n.contextMenuVisible,onItemClick:n.handleContextMenuItemClick,onClose:e[0]||(e[0]=g=>n.contextMenuVisible=!1)},null,8,["items","position","is-visible","onItemClick"])]),_:1},8,["item-id","name","indent","is-selected","is-collapsible","is-collapsed","onClick","onToggle","onContextmenu"])])}const Eqn=tt(eqn,[["render",Sqn],["__scopeId","data-v-c4adb9d9"]]),wG={openai:["gpt-5.3","gpt-5.2","gpt-5.2-mini"],anthropic:["claude-opus-4-6-20260514","claude-opus-4-20250514","claude-sonnet-4-20250514"],google:["models/gemini-2.5-pro","models/gemini-2.5-flash"]},xqn=h.defineComponent({name:"LLMConnectionCreator",props:{visible:{type:Boolean,required:!0},testTag:{type:String,required:!1,default:""}},methods:{close(){this.$emit("close")}},components:{LoadingButton:ya},setup(n,{emit:e}){const t=h.ref({name:"",type:"openai",options:{apiKey:"",model:ew.getDefaultModel(wG.openai),saveCredential:!1}}),i=h.inject("llmConnectionStore");if(!i)throw new Error("must inject llmConnectionStore to LLMConnectionCreator");const s=i.connections,r=()=>{t.value.name="",t.value.type="openai",t.value.options={apiKey:"",model:"",saveCredential:!1},o("openai")},o=c=>{switch(c){case"openai":t.value.options.model=ew.getDefaultModel(wG.openai);break;case"anthropic":t.value.options.model=Rv.getDefaultModel(wG.anthropic);break;case"google":t.value.options.model=Mv.getDefaultModel(wG.google);break;default:t.value.options.model=""}},a=async()=>{await l()},l=async()=>{if(!t.value.name)throw new Error("Connection name is required");if(!t.value.type)throw new Error("Provider type is required");if(!t.value.options.apiKey)throw new Error("API key is required");return await i.newConnection(t.value.name,t.value.type,t.value.options),e("close"),"Connection created successfully"};return{connectionDetails:t,connections:s,createConnection:r,handleSubmitConnection:l,submitConnectionCreation:a,updateDefaultModel:o}},watch:{"connectionDetails.type":{handler(n){this.updateDefaultModel(n)}}}}),kqn={key:0,class:"creator-container"},Tqn={class:"form-row"},Lqn={class:"form-row"},Iqn={class:"form-row"},Dqn={class:"form-row"},Nqn={class:"button-row"};function Rqn(n,e,t,i,s,r){const o=h.resolveComponent("loading-button");return n.visible?(h.openBlock(),h.createElementBlock("div",kqn,[h.createElementVNode("form",{onSubmit:e[5]||(e[5]=h.withModifiers((...a)=>n.submitConnectionCreation&&n.submitConnectionCreation(...a),["prevent"]))},[h.createElementVNode("div",Tqn,[e[6]||(e[6]=h.createElementVNode("label",{for:"llm-connection-name"},"Name",-1)),h.withDirectives(h.createElementVNode("input",{type:"text","onUpdate:modelValue":e[0]||(e[0]=a=>n.connectionDetails.name=a),id:"llm-connection-name",required:"","data-testid":"llm-connection-creator-name",placeholder:"Connection Name"},null,512),[[h.vModelText,n.connectionDetails.name]])]),h.createElementVNode("div",Lqn,[e[8]||(e[8]=h.createElementVNode("label",{for:"llm-provider-type"},"Provider",-1)),h.withDirectives(h.createElementVNode("select",{"onUpdate:modelValue":e[1]||(e[1]=a=>n.connectionDetails.type=a),id:"llm-provider-type",required:"","data-testid":"llm-connection-creator-type"},[...e[7]||(e[7]=[h.createElementVNode("option",{value:"openai","data-testid":"llm-connection-creator-openai"},"OpenAI",-1),h.createElementVNode("option",{value:"anthropic","data-testid":"llm-connection-creator-anthropic"}," Anthropic ",-1),h.createElementVNode("option",{value:"google","data-testid":"llm-connection-creator-google"},"Google",-1)])],512),[[h.vModelSelect,n.connectionDetails.type]])]),h.createElementVNode("div",Iqn,[e[9]||(e[9]=h.createElementVNode("label",{for:"llm-api-key"},"API Key",-1)),h.withDirectives(h.createElementVNode("input",{type:"password","onUpdate:modelValue":e[2]||(e[2]=a=>n.connectionDetails.options.apiKey=a),id:"llm-api-key",placeholder:"API Key",required:"","data-testid":"llm-connection-creator-api-key"},null,512),[[h.vModelText,n.connectionDetails.options.apiKey]])]),h.createElementVNode("div",Dqn,[e[10]||(e[10]=h.createElementVNode("label",{for:"save-credential"},"Save Credential?",-1)),h.withDirectives(h.createElementVNode("input",{type:"checkbox",id:"save-credential","onUpdate:modelValue":e[3]||(e[3]=a=>n.connectionDetails.options.saveCredential=a),"data-testid":"llm-connection-creator-save-credential"},null,512),[[h.vModelCheckbox,n.connectionDetails.options.saveCredential]])]),h.createElementVNode("div",Nqn,[h.createVNode(o,{"data-testid":"llm-connection-creator-submit",action:n.handleSubmitConnection,class:"submit-button"},{default:h.withCtx(()=>[...e[11]||(e[11]=[h.createTextVNode(" Submit ",-1)])]),_:1},8,["action"]),h.createElementVNode("button",{type:"button",onClick:e[4]||(e[4]=a=>n.close())},"Cancel")])],32)])):h.createCommentVNode("",!0)}const Mqn={name:"LLMConnectionList",props:{activeLLMKey:{type:String,default:"",optional:!0},testTag:{type:String,default:"",optional:!0}},emits:["llm-open-view","create-new-chat","open-chat"],setup(n,{emit:e}){const t=h.inject("llmConnectionStore"),i=h.inject("saveLLMConnections"),s=h.inject("chatStore",null);if(!t||!i)throw new Error("LLM connection store is not provided!");const r=h.ref({}),o=h.ref({}),a=h.ref(!1),l=async(b,y)=>{y&&(await t.connections[b.name].setApiKey(y),t.resetConnection(b.name),await i())},c=(b,y)=>{y&&(t.connections[b.name].setModel(y),t.resetConnection(b.name),i())},d=(b,y)=>{t.connections[b.name].setFastModel(y),i()},u=h.ref({}),f=async(b,y,_)=>{if(!t.connections[y]){o.value[b]="Connection not found";return}try{if(r.value[b]=!0,_==="connection"){const w=t.connections[y];w.testConnection&&await w.testConnection()}delete o.value[b]}catch(w){w instanceof Error?o.value[b]=w.message:o.value[b]="An error occurred"}delete r.value[b]},g=async(b,y,_,w)=>{if(_==="new-chat"){e("create-new-chat",y);return}if(_==="chat-item"){s&&(w!=null&&w.chatId)&&(s.setActiveChat(w.chatId),t.activeConnection=y),e("llm-open-view",y,"chat",w==null?void 0:w.chatId);return}if(_==="open-chat"){e("llm-open-view",y,"chat");return}if(_==="open-validation"){e("llm-open-view",y,"validation");return}if(_==="connection"&&(u.value[b]===void 0||u.value[b]===!0)){const C=t.connections[y];if(!C){console.log(`Connection not found ${C}`);return}(!C.models||C.models.length===0)&&await f(b,y,"models")}u.value[b]===void 0?u.value[b]=!1:u.value[b]=!u.value[b]};Object.entries(t.connections).forEach(([b,y])=>{let _=b;u.value[_]=!0}),h.onMounted(()=>{const b=ai("llm-key","");if(b){const y=b.split($t),_=y[0],w=y[1];_&&t.connections[_]&&(u.value[_]=!1,t.activeConnection=_,w&&s&&s.setActiveChat(w))}});const p=h.computed(()=>{const b=[];return Object.entries(t.connections).sort(([_,w],[C,E])=>{const S=w,x=E;return S.connected&&!x.connected?-1:!S.connected&&x.connected?1:_.localeCompare(C)}).forEach(([_,w])=>{var S;const C=w,E=((S=C.availableModels)==null?void 0:S.length)||0;if(!C.deleted&&(b.push({id:_,name:_,indent:0,count:E,type:"connection",connection:C}),u.value[_]===!1)){const x=s?s.getConnectionChats(_):[];b.push({id:`${_}-new-chat`,name:"New Chat",indent:1,count:x.length,type:"new-chat",connection:C}),x.forEach(k=>{b.push({id:`${_}-chat-${k.id}`,name:k.name,indent:2,count:k.messages.length,type:"chat-item",connection:C,chat:k,chatId:k.id})}),b.push({id:`${_}-open-validation`,name:"Validation Tests",indent:1,count:0,type:"open-validation",connection:C}),b.push({id:`${_}-api-key`,name:"API Key",indent:1,count:0,type:"api-key",connection:C}),b.push({id:`${_}-model`,name:"Model",indent:1,count:0,type:"model",connection:C}),b.push({id:`${_}-fast-model`,name:"Fast Model",indent:1,count:0,type:"fast-model",connection:C}),b.push({id:`${_}-toggle-save-credential`,name:"Toggle Save Credential",indent:1,count:0,type:"toggle-save-credential",connection:C}),r.value[_]&&b.push({id:`${_}-loading`,name:"Loading...",indent:1,count:0,type:"loading",connection:C}),o.value[_]&&b.push({id:`${_}-error`,name:o.value[_],indent:1,count:0,type:"error",connection:C})}}),b});return{llmConnectionStore:t,chatStore:s,contentList:p,toggleCollapse:g,collapsed:u,saveConnections:i,updateApiKey:l,updateModel:c,updateFastModel:d,refreshId:f,rightSplit:b=>{const y=b.lastIndexOf($t);return y!==-1?b.substring(0,y):b},creatorVisible:a,isItemSelected:b=>b.type==="chat-item"&&b.chatId&&s?b.chatId===s.activeChatId:b.type==="connection"?b.id===t.activeConnection:!1}},components:{SidebarList:DS,LLMConnectionListItem:Eqn,LLMConnectionCreator:tt(xqn,[["render",Rqn],["__scopeId","data-v-96f71520"]]),LoadingButton:ya,StatusIcon:RS,Tooltip:ko},methods:{resetConnection(n){return this.llmConnectionStore.resetConnection(n.name)},setActiveConnection(n){this.llmConnectionStore.activeConnection=n,this.llmConnectionStore.connections[n].isDefault=!0,this.llmConnectionStore.connections[n].changed=!0,Object.keys(this.llmConnectionStore.connections).forEach(e=>{e!==n&&this.llmConnectionStore.connections[e].isDefault&&(this.llmConnectionStore.connections[e].isDefault=!1,this.llmConnectionStore.connections[e].changed=!0)}),this.saveConnections()},deleteConnection(n,e){confirm(`Are you sure you want to delete the connection "${e}"?`)&&(this.llmConnectionStore.connections[e].delete(),this.llmConnectionStore.activeConnection===n&&(this.llmConnectionStore.activeConnection=""))},deleteChat(n,e){confirm("Are you sure you want to delete this chat?")&&this.chatStore&&this.chatStore.removeChat(n)},toggleSaveCredential(n){n.saveCredential=!n.saveCredential,this.saveConnections()}},computed:{connections(){return Object.values(this.llmConnectionStore.connections)}}},Bqn={class:"button-container"},Fqn=["data-testid"];function Oqn(n,e,t,i,s,r){const o=h.resolveComponent("LLMConnectionCreator"),a=h.resolveComponent("LLMConnectionListItem"),l=h.resolveComponent("sidebar-list");return h.openBlock(),h.createBlock(l,{title:"LLM Connections"},{actions:h.withCtx(()=>[h.createElementVNode("div",Bqn,[h.createElementVNode("button",{onClick:e[0]||(e[0]=c=>i.creatorVisible=!i.creatorVisible),"data-testid":t.testTag?`llm-connection-creator-add-${t.testTag}`:"llm-connection-creator-add"},h.toDisplayString(i.creatorVisible?"Hide":"New"),9,Fqn)]),h.createVNode(o,{visible:i.creatorVisible,onClose:e[1]||(e[1]=c=>i.creatorVisible=!i.creatorVisible)},null,8,["visible"])]),default:h.withCtx(()=>[(h.openBlock(!0),h.createElementBlock(h.Fragment,null,h.renderList(i.contentList,c=>(h.openBlock(),h.createBlock(a,{key:c.id,item:c,"is-collapsed":i.collapsed[c.id],isSelected:i.isItemSelected(c),onToggle:i.toggleCollapse,onRefresh:i.refreshId,onUpdateApiKey:i.updateApiKey,onUpdateModel:i.updateModel,onUpdateFastModel:i.updateFastModel,onSetActive:r.setActiveConnection,onDeleteConnection:r.deleteConnection,onDeleteChat:r.deleteChat,onToggleSaveCredential:r.toggleSaveCredential},null,8,["item","is-collapsed","isSelected","onToggle","onRefresh","onUpdateApiKey","onUpdateModel","onUpdateFastModel","onSetActive","onDeleteConnection","onDeleteChat","onToggleSaveCredential"]))),128))]),_:1})}const alt=tt(Mqn,[["render",Oqn],["__scopeId","data-v-6e87d854"]]);var Pqn=Object.defineProperty,Vqn=(n,e,t)=>e in n?Pqn(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,at=(n,e,t)=>(Vqn(n,typeof e!="symbol"?e+"":e,t),t);function Uqn(n){let e=0,t;for(let i=0,s=n.length;i<s;i++)t=n[i].y+n[i].h,t>e&&(e=t);return e}function M1e(n){const e=Array(n.length);for(let t=0,i=n.length;t<i;t++)e[t]=Hqn(n[t]);return e}function Hqn(n){return JSON.parse(JSON.stringify(n))}function llt(n,e){return!(n===e||n.x+n.w<=e.x||n.x>=e.x+e.w||n.y+n.h<=e.y||n.y>=e.y+e.h)}function sR(n,e,t){const i=ult(n),s=flt(n),r=Array(n.length);for(let o=0,a=s.length;o<a;o++){let l=s[o];l.static||(l=$qn(i,l,e,t),i.push(l)),r[n.indexOf(l)]=l,l.moved=!1}return r}function $qn(n,e,t,i){if(t)for(;e.y>0&&!J3(n,e);)e.y--;else if(i){const r=i[e.i].y;for(;e.y>r&&!J3(n,e);)e.y--}let s;for(;s=J3(n,e);)e.y=s.y+s.h;return e}function Wqn(n,e){const t=ult(n);for(let i=0,s=n.length;i<s;i++){const r=n[i];if(r.x+r.w>e.cols&&(r.x=e.cols-r.w),r.x<0&&(r.x=0,r.w=e.cols),!r.static)t.push(r);else for(;J3(t,r);)r.y++}return n}function clt(n,e){for(let t=0,i=n.length;t<i;t++)if(n[t].i===e)return n[t]}function J3(n,e){for(let t=0,i=n.length;t<i;t++)if(llt(n[t],e))return n[t]}function dlt(n,e){return n.filter(t=>llt(t,e))}function ult(n){return n.filter(e=>e.static)}function B1e(n,e,t,i,s,r){if(e.static)return n;const o=e.x,a=e.y,l=i&&e.y>i;typeof t=="number"&&(e.x=t),typeof i=="number"&&(e.y=i),e.moved=!0;let c=flt(n);l&&(c=c.reverse());const d=dlt(c,e);if(r&&d.length)return e.x=o,e.y=a,e.moved=!1,n;for(let u=0,f=d.length;u<f;u++){const g=d[u];g.moved||e.y>g.y&&e.y-g.y>g.h/4||(g.static?n=hlt(n,g,e,s):n=hlt(n,e,g,s))}return n}function hlt(n,e,t,i){if(i){const s={x:t.x,y:t.y,w:t.w,h:t.h};if(s.y=Math.max(e.y-t.h,0),!J3(n,s))return B1e(n,t,void 0,s.y,!1)}return B1e(n,t,void 0,t.y+1,!1)}function zqn(n,e,t,i){const s="translate3d("+e+"px,"+n+"px, 0)";return{transform:s,WebkitTransform:s,MozTransform:s,msTransform:s,OTransform:s,width:t+"px",height:i+"px",position:"absolute"}}function Qqn(n,e,t,i){const s="translate3d("+e*-1+"px,"+n+"px, 0)";return{transform:s,WebkitTransform:s,MozTransform:s,msTransform:s,OTransform:s,width:t+"px",height:i+"px",position:"absolute"}}function qqn(n,e,t,i){return{top:n+"px",left:e+"px",width:t+"px",height:i+"px",position:"absolute"}}function Kqn(n,e,t,i){return{top:n+"px",right:e+"px",width:t+"px",height:i+"px",position:"absolute"}}function flt(n){return[].concat(n).sort(function(e,t){return e.y===t.y&&e.x===t.x?0:e.y>t.y||e.y===t.y&&e.x>t.x?1:-1})}function jqn(n,e){e=e||"Layout";const t=["x","y","w","h"],i=[];if(!Array.isArray(n))throw new Error(e+" must be an array!");for(let s=0,r=n.length;s<r;s++){const o=n[s];for(let a=0;a<t.length;a++)if(typeof o[t[a]]!="number")throw new Error("VueGridLayout: "+e+"["+s+"]."+t[a]+" must be a number!");if(o.i===void 0||o.i===null)throw new Error("VueGridLayout: "+e+"["+s+"].i cannot be null!");if(typeof o.i!="number"&&typeof o.i!="string")throw new Error("VueGridLayout: "+e+"["+s+"].i must be a string or number!");if(i.indexOf(o.i)>=0)throw new Error("VueGridLayout: "+e+"["+s+"].i must be unique!");if(i.push(o.i),o.static!==void 0&&typeof o.static!="boolean")throw new Error("VueGridLayout: "+e+"["+s+"].static must be a boolean!")}}function glt(n){return Gqn(n)}function Gqn(n){const e=n.target,t=e.offsetParent||document.body,i=e.offsetParent===document.body?{left:0,top:0}:t.getBoundingClientRect(),s=n.clientX+t.scrollLeft-i.left,r=n.clientY+t.scrollTop-i.top;return{x:s,y:r}}function plt(n,e,t,i){return Yqn(n)?{deltaX:t-n,deltaY:i-e,lastX:n,lastY:e,x:t,y:i}:{deltaX:0,deltaY:0,lastX:t,lastY:i,x:t,y:i}}function Yqn(n){return typeof n=="number"&&!isNaN(n)}function Xqn(n,e){const t=mlt(n);let i=t[0];for(let s=1,r=t.length;s<r;s++){const o=t[s];e>n[o]&&(i=o)}return i}function F1e(n,e){if(!e[n])throw new Error("ResponsiveGridLayout: `cols` entry for breakpoint "+n+" is missing!");return e[n]}function Zqn(n,e,t,i,s,r,o){if(e[i])return M1e(e[i]);let a=n;const l=mlt(t),c=l.slice(l.indexOf(i));for(let d=0,u=c.length;d<u;d++){const f=c[d];if(e[f]){a=e[f];break}}return a=M1e(a||[]),sR(Wqn(a,{cols:r}),o)}function mlt(n){return Object.keys(n).sort(function(e,t){return n[e]-n[t]})}let Jqn="auto";function eKn(){return typeof document<"u"}function Alt(){return typeof window<"u"}function blt(){return eKn()?typeof document.dir<"u"?document.dir:document.getElementsByTagName("html")[0].getAttribute("dir")||"auto":Jqn}function tKn(n,e){return Alt?(window.addEventListener(n,e),!0):(e(),!1)}function nKn(n,e){!Alt||window.removeEventListener(n,e)}const Wf={init:iKn,document:null,DocumentFragment:null,SVGElement:null,SVGSVGElement:null,SVGElementInstance:null,Element:null,HTMLElement:null,Event:null,Touch:null,PointerEvent:null};function rR(){}const Uu=Wf;function iKn(n){const e=n;Wf.document=e.document,Wf.DocumentFragment=e.DocumentFragment||rR,Wf.SVGElement=e.SVGElement||rR,Wf.SVGSVGElement=e.SVGSVGElement||rR,Wf.SVGElementInstance=e.SVGElementInstance||rR,Wf.Element=e.Element||rR,Wf.HTMLElement=e.HTMLElement||Wf.Element,Wf.Event=e.Event,Wf.Touch=e.Touch||rR,Wf.PointerEvent=e.PointerEvent||e.MSPointerEvent}const ylt=n=>!!(n&&n.Window)&&n instanceof n.Window;let _lt,L0;function wlt(n){_lt=n;const e=n.document.createTextNode("");e.ownerDocument!==n.document&&typeof n.wrap=="function"&&n.wrap(e)===e&&(n=n.wrap(n)),L0=n}typeof window<"u"&&window&&wlt(window);function rx(n){return ylt(n)?n:(n.ownerDocument||n).defaultView||L0.window}const sKn=n=>n===L0||ylt(n),rKn=n=>CG(n)&&n.nodeType===11,CG=n=>!!n&&typeof n=="object",Clt=n=>typeof n=="function",oKn=n=>typeof n=="number",aKn=n=>typeof n=="boolean",lKn=n=>typeof n=="string",cKn=n=>{if(!n||typeof n!="object")return!1;const e=rx(n)||L0;return/object|function/.test(typeof Element)?n instanceof Element||n instanceof e.Element:n.nodeType===1&&typeof n.nodeName=="string"},dKn=n=>CG(n)&&!!n.constructor&&/function Object\b/.test(n.constructor.toString()),uKn=n=>CG(n)&&typeof n.length<"u"&&Clt(n.splice),ut={window:sKn,docFrag:rKn,object:CG,func:Clt,number:oKn,bool:aKn,string:lKn,element:cKn,plainObject:dKn,array:uKn},zf={init:hKn,supportsTouch:null,supportsPointerEvent:null,isIOS7:null,isIOS:null,isIe9:null,isOperaMobile:null,prefixedMatchesSelector:null,pEventTypes:null,wheelEvent:null};function hKn(n){const e=Uu.Element,t=n.navigator||{};zf.supportsTouch="ontouchstart"in n||ut.func(n.DocumentTouch)&&Uu.document instanceof n.DocumentTouch,zf.supportsPointerEvent=t.pointerEnabled!==!1&&!!Uu.PointerEvent,zf.isIOS=/iP(hone|od|ad)/.test(t.platform),zf.isIOS7=/iP(hone|od|ad)/.test(t.platform)&&/OS 7[^\d]/.test(t.appVersion),zf.isIe9=/MSIE 9/.test(t.userAgent),zf.isOperaMobile=t.appName==="Opera"&&zf.supportsTouch&&/Presto/.test(t.userAgent),zf.prefixedMatchesSelector="matches"in e.prototype?"matches":"webkitMatchesSelector"in e.prototype?"webkitMatchesSelector":"mozMatchesSelector"in e.prototype?"mozMatchesSelector":"oMatchesSelector"in e.prototype?"oMatchesSelector":"msMatchesSelector",zf.pEventTypes=zf.supportsPointerEvent?Uu.PointerEvent===n.MSPointerEvent?{up:"MSPointerUp",down:"MSPointerDown",over:"mouseover",out:"mouseout",move:"MSPointerMove",cancel:"MSPointerCancel"}:{up:"pointerup",down:"pointerdown",over:"pointerover",out:"pointerout",move:"pointermove",cancel:"pointercancel"}:null,zf.wheelEvent=Uu.document&&"onmousewheel"in Uu.document?"mousewheel":"wheel"}const Bp=zf;function ox(n,e){if(n.contains)return n.contains(e);for(;e;){if(e===n)return!0;e=e.parentNode}return!1}function vlt(n,e){for(;ut.element(n);){if(ax(n,e))return n;n=I0(n)}return null}function I0(n){let e=n.parentNode;if(ut.docFrag(e)){for(;(e=e.host)&&ut.docFrag(e););return e}return e}function ax(n,e){return L0!==_lt&&(e=e.replace(/\/deep\//g," ")),n[Bp.prefixedMatchesSelector](e)}function O1e(n,e,t){for(;ut.element(n);){if(ax(n,e))return!0;if(n=I0(n),n===t)return ax(n,e)}return!1}function Slt(n){return n.correspondingUseElement||n}function fKn(n){return n=n||L0,{x:n.scrollX||n.document.documentElement.scrollLeft,y:n.scrollY||n.document.documentElement.scrollTop}}function P1e(n){const e=n instanceof Uu.SVGElement?n.getBoundingClientRect():n.getClientRects()[0];return e&&{left:e.left,right:e.right,top:e.top,bottom:e.bottom,width:e.width||e.right-e.left,height:e.height||e.bottom-e.top}}function V1e(n){const e=P1e(n);if(!Bp.isIOS7&&e){const t=fKn(rx(n));e.left+=t.x,e.right+=t.x,e.top+=t.y,e.bottom+=t.y}return e}function Elt(n){return ut.string(n)?(Uu.document.querySelector(n),!0):!1}function In(n,e){for(const t in e)n[t]=e[t];return n}function eV(n,e){let t=!1;return function(){return t||(L0.console.warn(e),t=!0),n.apply(this,arguments)}}function xlt(n,e){return n.name=e.name,n.axis=e.axis,n.edges=e.edges,n}function gKn(n){const{Interactable:e}=n;e.prototype.getAction=function(t,i,s,r){const o=pKn(this,i,s,r,n);return this.options.actionChecker?this.options.actionChecker(t,i,o,this,r,s):o},e.prototype.ignoreFrom=eV(function(t){return this._backCompatOption("ignoreFrom",t)},"Interactable.ignoreFrom() has been deprecated. Use Interactble.draggable({ignoreFrom: newValue})."),e.prototype.allowFrom=eV(function(t){return this._backCompatOption("allowFrom",t)},"Interactable.allowFrom() has been deprecated. Use Interactble.draggable({allowFrom: newValue})."),e.prototype.actionChecker=AKn,e.prototype.styleCursor=mKn}function pKn(n,e,t,i,s){const r=n.getRect(i),o=e.buttons||{0:1,1:4,3:8,4:16}[e.button],a={action:null,interactable:n,interaction:t,element:i,rect:r,buttons:o};return s.fire("auto-start:check",a),a.action}function mKn(n){return ut.bool(n)?(this.options.styleCursor=n,this):n===null?(delete this.options.styleCursor,this):this.options.styleCursor}function AKn(n){return ut.func(n)?(this.options.actionChecker=n,this):n===null?(delete this.options.actionChecker,this):this.options.actionChecker}const bKn={id:"auto-start/interactableMethods",install:gKn};function yKn(n){const{interactStatic:e,defaults:t}=n;n.usePlugin(bKn),t.base.actionChecker=null,t.base.styleCursor=!0,In(t.perAction,{manualStart:!1,max:1/0,maxPerElement:1,allowFrom:null,ignoreFrom:null,mouseButtons:1}),e.maxInteractions=i=>Ilt(i,n),n.autoStart={maxInteractions:1/0,withinInteractionLimit:vG,cursorElement:null}}function _Kn({interaction:n,pointer:e,event:t,eventTarget:i},s){if(n.interacting())return;const r=Tlt(n,e,t,i,s);Llt(n,r,s)}function wKn({interaction:n,pointer:e,event:t,eventTarget:i},s){if(n.pointerType!=="mouse"||n.pointerIsDown||n.interacting())return;const r=Tlt(n,e,t,i,s);Llt(n,r,s)}function CKn(n,e){const{interaction:t}=n;if(!t.pointerIsDown||t.interacting()||!t.pointerWasMoved||!t.prepared.name)return;e.fire("autoStart:before-start",n);const{interactable:i}=t,s=t.prepared.name;s&&i&&(i.options[s].manualStart||!vG(i,t.element,t.prepared,e)?t.stop():(t.start(t.prepared,i,t.element),Dlt(t,e)))}function vKn({interaction:n},e){const{interactable:t}=n;t&&t.options.styleCursor&&U1e(n.element,"",e)}function klt(n,e,t,i,s){return e.testIgnoreAllow(e.options[n.name],t,i)&&e.options[n.name].enabled&&vG(e,t,n,s)?n:null}function SKn(n,e,t,i,s,r,o){for(let a=0,l=i.length;a<l;a++){const c=i[a],d=s[a],u=c.getAction(e,t,n,d);if(!u)continue;const f=klt(u,c,d,r,o);if(f)return{action:f,interactable:c,element:d}}return{action:null,interactable:null,element:null}}function Tlt(n,e,t,i,s){let r=[],o=[],a=i;function l(c){r.push(c),o.push(a)}for(;ut.element(a);){r=[],o=[],s.interactables.forEachMatch(a,l);const c=SKn(n,e,t,r,o,i,s);if(c.action&&!c.interactable.options[c.action.name].manualStart)return c;a=I0(a)}return{action:null,interactable:null,element:null}}function Llt(n,{action:e,interactable:t,element:i},s){e=e||{name:null},n.interactable=t,n.element=i,xlt(n.prepared,e),n.rect=t&&e.name?t.getRect(i):null,Dlt(n,s),s.fire("autoStart:prepared",{interaction:n})}function vG(n,e,t,i){const s=n.options,r=s[t.name].max,o=s[t.name].maxPerElement,a=i.autoStart.maxInteractions;let l=0,c=0,d=0;if(!(r&&o&&a))return!1;for(const u of i.interactions.list){const f=u.prepared.name;if(u.interacting()&&(l++,l>=a||u.interactable===n&&(c+=f===t.name?1:0,c>=r||u.element===e&&(d++,f===t.name&&d>=o))))return!1}return a>0}function Ilt(n,e){return ut.number(n)?(e.autoStart.maxInteractions=n,this):e.autoStart.maxInteractions}function U1e(n,e,t){const{cursorElement:i}=t.autoStart;i&&i!==n&&(i.style.cursor=""),n.ownerDocument.documentElement.style.cursor=e,n.style.cursor=e,t.autoStart.cursorElement=e?n:null}function Dlt(n,e){const{interactable:t,element:i,prepared:s}=n;if(!(n.pointerType==="mouse"&&t&&t.options.styleCursor)){e.autoStart.cursorElement&&U1e(e.autoStart.cursorElement,"",e);return}let r="";if(s.name){const o=t.options[s.name].cursorChecker;ut.func(o)?r=o(s,t,i,n._interacting):r=e.actions.map[s.name].getCursor(s)}U1e(n.element,r||"",e)}const EKn={id:"auto-start/base",before:["actions"],install:yKn,listeners:{"interactions:down":_Kn,"interactions:move":(n,e)=>{wKn(n,e),CKn(n,e)},"interactions:stop":vKn},maxInteractions:Ilt,withinInteractionLimit:vG,validateAction:klt},H1e=EKn;function xKn({interaction:n,eventTarget:e,dx:t,dy:i},s){if(n.prepared.name!=="drag")return;const r=Math.abs(t),o=Math.abs(i),a=n.interactable.options.drag,l=a.startAxis,c=r>o?"x":r<o?"y":"xy";if(n.prepared.axis=a.lockAxis==="start"?c[0]:a.lockAxis,c!=="xy"&&l!=="xy"&&l!==c){n.prepared.name=null;let d=e;const u=function(f){if(f===n.interactable)return;const g=n.interactable.options.drag;if(!g.manualStart&&f.testIgnoreAllow(g,d,e)){const p=f.getAction(n.downPointer,n.downEvent,n,d);if(p&&p.name==="drag"&&kKn(c,f)&&H1e.validateAction(p,f,d,e,s))return f}};for(;ut.element(d);){const f=s.interactables.forEachMatch(d,u);if(f){n.prepared.name="drag",n.interactable=f,n.element=d;break}d=I0(d)}}}function kKn(n,e){if(!e)return!1;const t=e.options.drag.startAxis;return n==="xy"||t==="xy"||t===n}const TKn={id:"auto-start/dragAxis",listeners:{"autoStart:before-start":xKn}};function LKn(n){const{defaults:e}=n;n.usePlugin(H1e),e.perAction.hold=0,e.perAction.delay=0}function $1e(n){const e=n.prepared&&n.prepared.name;if(!e)return null;const t=n.interactable.options;return t[e].hold||t[e].delay}const IKn={id:"auto-start/hold",install:LKn,listeners:{"interactions:new":({interaction:n})=>{n.autoStartHoldTimer=null},"autoStart:prepared":({interaction:n})=>{const e=$1e(n);e>0&&(n.autoStartHoldTimer=setTimeout(()=>{n.start(n.prepared,n.interactable,n.element)},e))},"interactions:move":({interaction:n,duplicate:e})=>{n.autoStartHoldTimer&&n.pointerWasMoved&&!e&&(clearTimeout(n.autoStartHoldTimer),n.autoStartHoldTimer=null)},"autoStart:before-start":({interaction:n})=>{$1e(n)>0&&(n.prepared.name=null)}},getHoldDuration:$1e},DKn=IKn,NKn={id:"auto-start",install(n){n.usePlugin(H1e),n.usePlugin(DKn),n.usePlugin(TKn)}},RKn=(n,e)=>n.indexOf(e)!==-1,Nlt=(n,e)=>{for(const t of e)n.push(t);return n},Rlt=n=>Nlt([],n),SG=(n,e)=>{for(let t=0;t<n.length;t++)if(e(n[t],t,n))return t;return-1},W1e=(n,e)=>n[SG(n,e)];function oR(n){const e={};for(const t in n){const i=n[t];ut.plainObject(i)?e[t]=oR(i):ut.array(i)?e[t]=Rlt(i):e[t]=i}return e}let Mlt=0,g_,lx;function MKn(n){if(g_=n.requestAnimationFrame,lx=n.cancelAnimationFrame,!g_){const e=["ms","moz","webkit","o"];for(const t of e)g_=n[`${t}RequestAnimationFrame`],lx=n[`${t}CancelAnimationFrame`]||n[`${t}CancelRequestAnimationFrame`]}g_=g_&&g_.bind(n),lx=lx&&lx.bind(n),g_||(g_=e=>{const t=Date.now(),i=Math.max(0,16-(t-Mlt)),s=n.setTimeout(()=>{e(t+i)},i);return Mlt=t+i,s},lx=e=>clearTimeout(e))}const aR={request:n=>g_(n),cancel:n=>lx(n),init:MKn};function lR(n,e,t){if(t=t||{},ut.string(n)&&n.search(" ")!==-1&&(n=Blt(n)),ut.array(n))return n.reduce((i,s)=>In(i,lR(s,e,t)),t);if(ut.object(n)&&(e=n,n=""),ut.func(e))t[n]=t[n]||[],t[n].push(e);else if(ut.array(e))for(const i of e)lR(n,i,t);else if(ut.object(e))for(const i in e){const s=Blt(i).map(r=>`${n}${r}`);lR(s,e[i],t)}return t}function Blt(n){return n.trim().split(/ +/)}function Flt(n,e){for(const t of e){if(n.immediatePropagationStopped)break;t(n)}}class Olt{constructor(e){at(this,"options"),at(this,"types",{}),at(this,"propagationStopped",!1),at(this,"immediatePropagationStopped",!1),at(this,"global"),this.options=In({},e||{})}fire(e){let t;const i=this.global;(t=this.types[e.type])&&Flt(e,t),!e.propagationStopped&&i&&(t=i[e.type])&&Flt(e,t)}on(e,t){const i=lR(e,t);for(e in i)this.types[e]=Nlt(this.types[e]||[],i[e])}off(e,t){const i=lR(e,t);for(e in i){const s=this.types[e];if(!(!s||!s.length))for(const r of i[e]){const o=s.indexOf(r);o!==-1&&s.splice(o,1)}}}getRect(e){return null}}function Plt(n,e,t){return n==="parent"?I0(t):n==="self"?e.getRect(t):vlt(t,n)}function tV(n,e,t,i){let s=n;return ut.string(s)?s=Plt(s,e,t):ut.func(s)&&(s=s(...i)),ut.element(s)&&(s=V1e(s)),s}function EG(n){return n&&{x:"x"in n?n.x:n.left,y:"y"in n?n.y:n.top}}function BKn(n){return n&&!("left"in n&&"top"in n)&&(n=In({},n),n.left=n.x||0,n.top=n.y||0,n.right=n.right||n.left+n.width,n.bottom=n.bottom||n.top+n.height),n}function Vlt(n){return n&&!("x"in n&&"y"in n)&&(n=In({},n),n.x=n.left||0,n.y=n.top||0,n.width=n.width||(n.right||0)-n.x,n.height=n.height||(n.bottom||0)-n.y),n}function z1e(n,e,t){n.left&&(e.left+=t.x),n.right&&(e.right+=t.x),n.top&&(e.top+=t.y),n.bottom&&(e.bottom+=t.y),e.width=e.right-e.left,e.height=e.bottom-e.top}function Q1e(n,e,t){const i=n.options[t],s=i&&i.origin||n.options.origin,r=tV(s,n,e,[n&&e]);return EG(r)||{x:0,y:0}}const xG=(n,e)=>Math.sqrt(n*n+e*e);class Ult{constructor(e){at(this,"immediatePropagationStopped",!1),at(this,"propagationStopped",!1),this._interaction=e}preventDefault(){}stopPropagation(){this.propagationStopped=!0}stopImmediatePropagation(){this.immediatePropagationStopped=this.propagationStopped=!0}}Object.defineProperty(Ult.prototype,"interaction",{get(){return this._interaction._proxy},set(){}});const Hlt={base:{preventDefault:"auto",deltaSource:"page"},perAction:{enabled:!1,origin:{x:0,y:0}},actions:{}};class q1e extends Ult{constructor(e,t,i,s,r,o,a){super(e),at(this,"relatedTarget",null),at(this,"screenX"),at(this,"screenY"),at(this,"button"),at(this,"buttons"),at(this,"ctrlKey"),at(this,"shiftKey"),at(this,"altKey"),at(this,"metaKey"),at(this,"page"),at(this,"client"),at(this,"delta"),at(this,"rect"),at(this,"x0"),at(this,"y0"),at(this,"t0"),at(this,"dt"),at(this,"duration"),at(this,"clientX0"),at(this,"clientY0"),at(this,"velocity"),at(this,"speed"),at(this,"swipe"),at(this,"axes"),at(this,"preEnd"),r=r||e.element;const l=e.interactable,c=(l&&l.options||Hlt).deltaSource,d=Q1e(l,r,i),u=s==="start",f=s==="end",g=u?this:e.prevEvent,p=u?e.coords.start:f?{page:g.page,client:g.client,timeStamp:e.coords.cur.timeStamp}:e.coords.cur;this.page=In({},p.page),this.client=In({},p.client),this.rect=In({},e.rect),this.timeStamp=p.timeStamp,f||(this.page.x-=d.x,this.page.y-=d.y,this.client.x-=d.x,this.client.y-=d.y),this.ctrlKey=t.ctrlKey,this.altKey=t.altKey,this.shiftKey=t.shiftKey,this.metaKey=t.metaKey,this.button=t.button,this.buttons=t.buttons,this.target=r,this.currentTarget=r,this.preEnd=o,this.type=a||i+(s||""),this.interactable=l,this.t0=u?e.pointers[e.pointers.length-1].downTime:g.t0,this.x0=e.coords.start.page.x-d.x,this.y0=e.coords.start.page.y-d.y,this.clientX0=e.coords.start.client.x-d.x,this.clientY0=e.coords.start.client.y-d.y,u||f?this.delta={x:0,y:0}:this.delta={x:this[c].x-g[c].x,y:this[c].y-g[c].y},this.dt=e.coords.delta.timeStamp,this.duration=this.timeStamp-this.t0,this.velocity=In({},e.coords.velocity[c]),this.speed=xG(this.velocity.x,this.velocity.y),this.swipe=f||s==="inertiastart"?this.getSwipe():null}getSwipe(){const e=this._interaction;if(e.prevEvent.speed<600||this.timeStamp-e.prevEvent.timeStamp>150)return null;let t=180*Math.atan2(e.prevEvent.velocityY,e.prevEvent.velocityX)/Math.PI;const i=22.5;t<0&&(t+=360);const s=135-i<=t&&t<225+i,r=225-i<=t&&t<315+i,o=!s&&(315-i<=t||t<45+i),a=!r&&45-i<=t&&t<135+i;return{up:r,down:a,left:s,right:o,angle:t,speed:e.prevEvent.speed,velocity:{x:e.prevEvent.velocityX,y:e.prevEvent.velocityY}}}preventDefault(){}stopImmediatePropagation(){this.immediatePropagationStopped=this.propagationStopped=!0}stopPropagation(){this.propagationStopped=!0}}Object.defineProperties(q1e.prototype,{pageX:{get(){return this.page.x},set(n){this.page.x=n}},pageY:{get(){return this.page.y},set(n){this.page.y=n}},clientX:{get(){return this.client.x},set(n){this.client.x=n}},clientY:{get(){return this.client.y},set(n){this.client.y=n}},dx:{get(){return this.delta.x},set(n){this.delta.x=n}},dy:{get(){return this.delta.y},set(n){this.delta.y=n}},velocityX:{get(){return this.velocity.x},set(n){this.velocity.x=n}},velocityY:{get(){return this.velocity.y},set(n){this.velocity.y=n}}});function $lt(n,e){n.__set||(n.__set={});for(const t in e)typeof n[t]!="function"&&t!=="__set"&&Object.defineProperty(n,t,{get(){return t in n.__set?n.__set[t]:n.__set[t]=e[t]},set(i){n.__set[t]=i},configurable:!0});return n}function K1e(n,e){n.page=n.page||{},n.page.x=e.page.x,n.page.y=e.page.y,n.client=n.client||{},n.client.x=e.client.x,n.client.y=e.client.y,n.timeStamp=e.timeStamp}function FKn(n,e,t){n.page.x=t.page.x-e.page.x,n.page.y=t.page.y-e.page.y,n.client.x=t.client.x-e.client.x,n.client.y=t.client.y-e.client.y,n.timeStamp=t.timeStamp-e.timeStamp}function OKn(n,e){const t=Math.max(e.timeStamp/1e3,.001);n.page.x=e.page.x/t,n.page.y=e.page.y/t,n.client.x=e.client.x/t,n.client.y=e.client.y/t,n.timeStamp=t}function PKn(n){n.page.x=0,n.page.y=0,n.client.x=0,n.client.y=0}function Wlt(n){return n instanceof Uu.Event||n instanceof Uu.Touch}function kG(n,e,t){return t=t||{},n=n||"page",t.x=e[n+"X"],t.y=e[n+"Y"],t}function VKn(n,e){return e=e||{x:0,y:0},Bp.isOperaMobile&&Wlt(n)?(kG("screen",n,e),e.x+=window.scrollX,e.y+=window.scrollY):kG("page",n,e),e}function UKn(n,e){return e=e||{},Bp.isOperaMobile&&Wlt(n)?kG("screen",n,e):kG("client",n,e),e}function TG(n){return ut.number(n.pointerId)?n.pointerId:n.identifier}function HKn(n,e,t){const i=e.length>1?zlt(e):e[0];VKn(i,n.page),UKn(i,n.client),n.timeStamp=t}function j1e(n){const e=[];return ut.array(n)?(e[0]=n[0],e[1]=n[1]):n.type==="touchend"?n.touches.length===1?(e[0]=n.touches[0],e[1]=n.changedTouches[0]):n.touches.length===0&&(e[0]=n.changedTouches[0],e[1]=n.changedTouches[1]):(e[0]=n.touches[0],e[1]=n.touches[1]),e}function zlt(n){const e={pageX:0,pageY:0,clientX:0,clientY:0,screenX:0,screenY:0};for(const t of n)for(const i in e)e[i]+=t[i];for(const t in e)e[t]/=n.length;return e}function $Kn(n){if(!n.length)return null;const e=j1e(n),t=Math.min(e[0].pageX,e[1].pageX),i=Math.min(e[0].pageY,e[1].pageY),s=Math.max(e[0].pageX,e[1].pageX),r=Math.max(e[0].pageY,e[1].pageY);return{x:t,y:i,left:t,top:i,right:s,bottom:r,width:s-t,height:r-i}}function WKn(n,e){const t=e+"X",i=e+"Y",s=j1e(n),r=s[0][t]-s[1][t],o=s[0][i]-s[1][i];return xG(r,o)}function zKn(n,e){const t=e+"X",i=e+"Y",s=j1e(n),r=s[1][t]-s[0][t],o=s[1][i]-s[0][i];return 180*Math.atan2(o,r)/Math.PI}function QKn(n){return ut.string(n.pointerType)?n.pointerType:ut.number(n.pointerType)?[void 0,void 0,"touch","pen","mouse"][n.pointerType]:/touch/.test(n.type||"")||n instanceof Uu.Touch?"touch":"mouse"}function Qlt(n){const e=ut.func(n.composedPath)?n.composedPath():n.path;return[Slt(e?e[0]:n.target),Slt(n.currentTarget)]}function nV(){return{page:{x:0,y:0},client:{x:0,y:0},timeStamp:0}}function G1e(n,e){if(e.phaselessTypes[n])return!0;for(const t in e.map)if(n.indexOf(t)===0&&n.substr(t.length)in e.phases)return!0;return!1}function qKn(n){const e=(t,i)=>{let s=n.interactables.get(t,i);return s||(s=n.interactables.new(t,i),s.events.global=e.globalEvents),s};return e.getPointerAverage=zlt,e.getTouchBBox=$Kn,e.getTouchDistance=WKn,e.getTouchAngle=zKn,e.getElementRect=V1e,e.getElementClientRect=P1e,e.matchesSelector=ax,e.closest=vlt,e.globalEvents={},e.version="1.10.18",e.scope=n,e.use=function(t,i){return this.scope.usePlugin(t,i),this},e.isSet=function(t,i){return!!this.scope.interactables.get(t,i&&i.context)},e.on=eV(function(t,i,s){if(ut.string(t)&&t.search(" ")!==-1&&(t=t.trim().split(/ +/)),ut.array(t)){for(const r of t)this.on(r,i,s);return this}if(ut.object(t)){for(const r in t)this.on(r,t[r],i);return this}return G1e(t,this.scope.actions)?this.globalEvents[t]?this.globalEvents[t].push(i):this.globalEvents[t]=[i]:this.scope.events.add(this.scope.document,t,i,{options:s}),this},"The interact.on() method is being deprecated"),e.off=eV(function(t,i,s){if(ut.string(t)&&t.search(" ")!==-1&&(t=t.trim().split(/ +/)),ut.array(t)){for(const r of t)this.off(r,i,s);return this}if(ut.object(t)){for(const r in t)this.off(r,t[r],i);return this}if(G1e(t,this.scope.actions)){let r;t in this.globalEvents&&(r=this.globalEvents[t].indexOf(i))!==-1&&this.globalEvents[t].splice(r,1)}else this.scope.events.remove(this.scope.document,t,i,s);return this},"The interact.off() method is being deprecated"),e.debug=function(){return this.scope},e.supportsTouch=function(){return Bp.supportsTouch},e.supportsPointerEvent=function(){return Bp.supportsPointerEvent},e.stop=function(){for(const t of this.scope.interactions.list)t.stop();return this},e.pointerMoveTolerance=function(t){return ut.number(t)?(this.scope.interactions.pointerMoveTolerance=t,this):this.scope.interactions.pointerMoveTolerance},e.addDocument=function(t,i){this.scope.addDocument(t,i)},e.removeDocument=function(t){this.scope.removeDocument(t)},e}class KKn{constructor(e,t,i,s){at(this,"options"),at(this,"_actions"),at(this,"target"),at(this,"events",new Olt),at(this,"_context"),at(this,"_win"),at(this,"_doc"),at(this,"_scopeEvents"),at(this,"_rectChecker"),this._actions=t.actions,this.target=e,this._context=t.context||i,this._win=rx(Elt(e)?this._context:e),this._doc=this._win.document,this._scopeEvents=s,this.set(t)}get _defaults(){return{base:{},perAction:{},actions:{}}}setOnEvents(e,t){return ut.func(t.onstart)&&this.on(`${e}start`,t.onstart),ut.func(t.onmove)&&this.on(`${e}move`,t.onmove),ut.func(t.onend)&&this.on(`${e}end`,t.onend),ut.func(t.oninertiastart)&&this.on(`${e}inertiastart`,t.oninertiastart),this}updatePerActionListeners(e,t,i){(ut.array(t)||ut.object(t))&&this.off(e,t),(ut.array(i)||ut.object(i))&&this.on(e,i)}setPerAction(e,t){const i=this._defaults;for(const s in t){const r=s,o=this.options[e],a=t[r];r==="listeners"&&this.updatePerActionListeners(e,o.listeners,a),ut.array(a)?o[r]=Rlt(a):ut.plainObject(a)?(o[r]=In(o[r]||{},oR(a)),ut.object(i.perAction[r])&&"enabled"in i.perAction[r]&&(o[r].enabled=a.enabled!==!1)):ut.bool(a)&&ut.object(i.perAction[r])?o[r].enabled=a:o[r]=a}}getRect(e){return e=e||(ut.element(this.target)?this.target:null),ut.string(this.target)&&(e=e||this._context.querySelector(this.target)),V1e(e)}rectChecker(e){return ut.func(e)?(this._rectChecker=e,this.getRect=t=>{const i=In({},this._rectChecker(t));return"width"in i||(i.width=i.right-i.left,i.height=i.bottom-i.top),i},this):e===null?(delete this.getRect,delete this._rectChecker,this):this.getRect}_backCompatOption(e,t){if(Elt(t)||ut.object(t)){this.options[e]=t;for(const i in this._actions.map)this.options[i][e]=t;return this}return this.options[e]}origin(e){return this._backCompatOption("origin",e)}deltaSource(e){return e==="page"||e==="client"?(this.options.deltaSource=e,this):this.options.deltaSource}context(){return this._context}inContext(e){return this._context===e.ownerDocument||ox(this._context,e)}testIgnoreAllow(e,t,i){return!this.testIgnore(e.ignoreFrom,t,i)&&this.testAllow(e.allowFrom,t,i)}testAllow(e,t,i){return e?ut.element(i)?ut.string(e)?O1e(i,e,t):ut.element(e)?ox(e,i):!1:!1:!0}testIgnore(e,t,i){return!e||!ut.element(i)?!1:ut.string(e)?O1e(i,e,t):ut.element(e)?ox(e,i):!1}fire(e){return this.events.fire(e),this}_onOff(e,t,i,s){ut.object(t)&&!ut.array(t)&&(s=i,i=null);const r=e==="on"?"add":"remove",o=lR(t,i);for(let a in o){a==="wheel"&&(a=Bp.wheelEvent);for(const l of o[a])G1e(a,this._actions)?this.events[e](a,l):ut.string(this.target)?this._scopeEvents[`${r}Delegate`](this.target,this._context,a,l,s):this._scopeEvents[r](this.target,a,l,s)}return this}on(e,t,i){return this._onOff("on",e,t,i)}off(e,t,i){return this._onOff("off",e,t,i)}set(e){const t=this._defaults;ut.object(e)||(e={}),this.options=oR(t.base);for(const i in this._actions.methodDict){const s=i,r=this._actions.methodDict[s];this.options[s]={},this.setPerAction(s,In(In({},t.perAction),t.actions[s])),this[r](e[s])}for(const i in e)ut.func(this[i])&&this[i](e[i]);return this}unset(){if(ut.string(this.target))for(const e in this._scopeEvents.delegatedEvents){const t=this._scopeEvents.delegatedEvents[e];for(let i=t.length-1;i>=0;i--){const{selector:s,context:r,listeners:o}=t[i];s===this.target&&r===this._context&&t.splice(i,1);for(let a=o.length-1;a>=0;a--)this._scopeEvents.removeDelegate(this.target,this._context,e,o[a][0],o[a][1])}}else this._scopeEvents.remove(this.target,"all")}}class jKn{constructor(e){at(this,"list",[]),at(this,"selectorMap",{}),at(this,"scope"),this.scope=e,e.addListeners({"interactable:unset":({interactable:t})=>{const{target:i,_context:s}=t,r=ut.string(i)?this.selectorMap[i]:i[this.scope.id],o=SG(r,a=>a.context===s);r[o]&&(r[o].context=null,r[o].interactable=null),r.splice(o,1)}})}new(e,t){t=In(t||{},{actions:this.scope.actions});const i=new this.scope.Interactable(e,t,this.scope.document,this.scope.events),s={context:i._context,interactable:i};return this.scope.addDocument(i._doc),this.list.push(i),ut.string(e)?(this.selectorMap[e]||(this.selectorMap[e]=[]),this.selectorMap[e].push(s)):(i.target[this.scope.id]||Object.defineProperty(e,this.scope.id,{value:[],configurable:!0}),e[this.scope.id].push(s)),this.scope.fire("interactable:new",{target:e,options:t,interactable:i,win:this.scope._win}),i}get(e,t){const i=t&&t.context||this.scope.document,s=ut.string(e),r=s?this.selectorMap[e]:e[this.scope.id];if(!r)return null;const o=W1e(r,a=>a.context===i&&(s||a.interactable.inContext(e)));return o&&o.interactable}forEachMatch(e,t){for(const i of this.list){let s;if((ut.string(i.target)?ut.element(e)&&ax(e,i.target):e===i.target)&&i.inContext(e)&&(s=t(i)),s!==void 0)return s}}}function GKn(n){var e;const t=[],i={},s=[],r={add:o,remove:a,addDelegate:l,removeDelegate:c,delegateListener:d,delegateUseCapture:u,delegatedEvents:i,documents:s,targets:t,supportsOptions:!1,supportsPassive:!1};(e=n.document)==null||e.createElement("div").addEventListener("test",null,{get capture(){return r.supportsOptions=!0},get passive(){return r.supportsPassive=!0}}),n.events=r;function o(f,g,p,m){const A=iV(m);let b=W1e(t,y=>y.eventTarget===f);b||(b={eventTarget:f,events:{}},t.push(b)),b.events[g]||(b.events[g]=[]),f.addEventListener&&!RKn(b.events[g],p)&&(f.addEventListener(g,p,r.supportsOptions?A:A.capture),b.events[g].push(p))}function a(f,g,p,m){const A=iV(m),b=SG(t,C=>C.eventTarget===f),y=t[b];if(!y||!y.events)return;if(g==="all"){for(g in y.events)y.events.hasOwnProperty(g)&&a(f,g,"all");return}let _=!1;const w=y.events[g];if(w){if(p==="all"){for(let C=w.length-1;C>=0;C--)a(f,g,w[C],A);return}else for(let C=0;C<w.length;C++)if(w[C]===p){f.removeEventListener(g,p,r.supportsOptions?A:A.capture),w.splice(C,1),w.length===0&&(delete y.events[g],_=!0);break}}_&&!Object.keys(y.events).length&&t.splice(b,1)}function l(f,g,p,m,A){const b=iV(A);if(!i[p]){i[p]=[];for(const w of s)o(w,p,d),o(w,p,u,!0)}const y=i[p];let _=W1e(y,w=>w.selector===f&&w.context===g);_||(_={selector:f,context:g,listeners:[]},y.push(_)),_.listeners.push([m,b])}function c(f,g,p,m,A){const b=iV(A),y=i[p];let _=!1,w;if(y)for(w=y.length-1;w>=0;w--){const C=y[w];if(C.selector===f&&C.context===g){const{listeners:E}=C;for(let S=E.length-1;S>=0;S--){const[x,{capture:k,passive:I}]=E[S];if(x===m&&k===b.capture&&I===b.passive){E.splice(S,1),E.length||(y.splice(w,1),a(g,p,d),a(g,p,u,!0)),_=!0;break}}if(_)break}}}function d(f,g){const p=iV(g),m=new YKn(f),A=i[f.type],[b]=Qlt(f);let y=b;for(;ut.element(y);){for(let _=0;_<A.length;_++){const w=A[_],{selector:C,context:E}=w;if(ax(y,C)&&ox(E,b)&&ox(E,y)){const{listeners:S}=w;m.currentTarget=y;for(const[x,{capture:k,passive:I}]of S)k===p.capture&&I===p.passive&&x(m)}}y=I0(y)}}function u(f){return d.call(this,f,!0)}return r}class YKn{constructor(e){at(this,"currentTarget"),at(this,"originalEvent"),at(this,"type"),this.originalEvent=e,$lt(this,e)}preventOriginalDefault(){this.originalEvent.preventDefault()}stopPropagation(){this.originalEvent.stopPropagation()}stopImmediatePropagation(){this.originalEvent.stopImmediatePropagation()}}function iV(n){if(!ut.object(n))return{capture:!!n,passive:!1};const e=In({},n);return e.capture=!!n.capture,e.passive=!!n.passive,e}const XKn={id:"events",install:GKn};class ZKn{constructor(e,t,i,s,r){at(this,"id"),at(this,"pointer"),at(this,"event"),at(this,"downTime"),at(this,"downTarget"),this.id=e,this.pointer=t,this.event=i,this.downTime=s,this.downTarget=r}}let Y1e;(function(n){n.interactable="",n.element="",n.prepared="",n.pointerIsDown="",n.pointerWasMoved="",n._proxy=""})(Y1e||(Y1e={}));let X1e;(function(n){n.start="",n.move="",n.end="",n.stop="",n.interacting=""})(X1e||(X1e={}));let JKn=0;class ejn{constructor({pointerType:e,scopeFire:t}){at(this,"interactable",null),at(this,"element",null),at(this,"rect",null),at(this,"_rects"),at(this,"edges",null),at(this,"_scopeFire"),at(this,"prepared",{name:null,axis:null,edges:null}),at(this,"pointerType"),at(this,"pointers",[]),at(this,"downEvent",null),at(this,"downPointer",{}),at(this,"_latestPointer",{pointer:null,event:null,eventTarget:null}),at(this,"prevEvent",null),at(this,"pointerIsDown",!1),at(this,"pointerWasMoved",!1),at(this,"_interacting",!1),at(this,"_ending",!1),at(this,"_stopped",!0),at(this,"_proxy",null),at(this,"simulation",null),at(this,"doMove",eV(function(s){this.move(s)},"The interaction.doMove() method has been renamed to interaction.move()")),at(this,"coords",{start:nV(),prev:nV(),cur:nV(),delta:nV(),velocity:nV()}),at(this,"_id",JKn++),this._scopeFire=t,this.pointerType=e;const i=this;this._proxy={};for(const s in Y1e)Object.defineProperty(this._proxy,s,{get(){return i[s]}});for(const s in X1e)Object.defineProperty(this._proxy,s,{value:(...r)=>i[s](...r)});this._scopeFire("interactions:new",{interaction:this})}get pointerMoveTolerance(){return 1}pointerDown(e,t,i){const s=this.updatePointer(e,t,i,!0),r=this.pointers[s];this._scopeFire("interactions:down",{pointer:e,event:t,eventTarget:i,pointerIndex:s,pointerInfo:r,type:"down",interaction:this})}start(e,t,i){return this.interacting()||!this.pointerIsDown||this.pointers.length<(e.name==="gesture"?2:1)||!t.options[e.name].enabled?!1:(xlt(this.prepared,e),this.interactable=t,this.element=i,this.rect=t.getRect(i),this.edges=this.prepared.edges?In({},this.prepared.edges):{left:!0,right:!0,top:!0,bottom:!0},this._stopped=!1,this._interacting=this._doPhase({interaction:this,event:this.downEvent,phase:"start"})&&!this._stopped,this._interacting)}pointerMove(e,t,i){!this.simulation&&!(this.modification&&this.modification.endResult)&&this.updatePointer(e,t,i,!1);const s=this.coords.cur.page.x===this.coords.prev.page.x&&this.coords.cur.page.y===this.coords.prev.page.y&&this.coords.cur.client.x===this.coords.prev.client.x&&this.coords.cur.client.y===this.coords.prev.client.y;let r,o;this.pointerIsDown&&!this.pointerWasMoved&&(r=this.coords.cur.client.x-this.coords.start.client.x,o=this.coords.cur.client.y-this.coords.start.client.y,this.pointerWasMoved=xG(r,o)>this.pointerMoveTolerance);const a=this.getPointerIndex(e),l={pointer:e,pointerIndex:a,pointerInfo:this.pointers[a],event:t,type:"move",eventTarget:i,dx:r,dy:o,duplicate:s,interaction:this};s||OKn(this.coords.velocity,this.coords.delta),this._scopeFire("interactions:move",l),!s&&!this.simulation&&(this.interacting()&&(l.type=null,this.move(l)),this.pointerWasMoved&&K1e(this.coords.prev,this.coords.cur))}move(e){(!e||!e.event)&&PKn(this.coords.delta),e=In({pointer:this._latestPointer.pointer,event:this._latestPointer.event,eventTarget:this._latestPointer.eventTarget,interaction:this},e||{}),e.phase="move",this._doPhase(e)}pointerUp(e,t,i,s){let r=this.getPointerIndex(e);r===-1&&(r=this.updatePointer(e,t,i,!1));const o=/cancel$/i.test(t.type)?"cancel":"up";this._scopeFire(`interactions:${o}`,{pointer:e,pointerIndex:r,pointerInfo:this.pointers[r],event:t,eventTarget:i,type:o,curEventTarget:s,interaction:this}),this.simulation||this.end(t),this.removePointer(e,t)}documentBlur(e){this.end(e),this._scopeFire("interactions:blur",{event:e,type:"blur",interaction:this})}end(e){this._ending=!0,e=e||this._latestPointer.event;let t;this.interacting()&&(t=this._doPhase({event:e,interaction:this,phase:"end"})),this._ending=!1,t===!0&&this.stop()}currentAction(){return this._interacting?this.prepared.name:null}interacting(){return this._interacting}stop(){this._scopeFire("interactions:stop",{interaction:this}),this.interactable=this.element=null,this._interacting=!1,this._stopped=!0,this.prepared.name=this.prevEvent=null}getPointerIndex(e){const t=TG(e);return this.pointerType==="mouse"||this.pointerType==="pen"?this.pointers.length-1:SG(this.pointers,i=>i.id===t)}getPointerInfo(e){return this.pointers[this.getPointerIndex(e)]}updatePointer(e,t,i,s){const r=TG(e);let o=this.getPointerIndex(e),a=this.pointers[o];return s=s===!1?!1:s||/(down|start)$/i.test(t.type),a?a.pointer=e:(a=new ZKn(r,e,t,null,null),o=this.pointers.length,this.pointers.push(a)),HKn(this.coords.cur,this.pointers.map(l=>l.pointer),this._now()),FKn(this.coords.delta,this.coords.prev,this.coords.cur),s&&(this.pointerIsDown=!0,a.downTime=this.coords.cur.timeStamp,a.downTarget=i,$lt(this.downPointer,e),this.interacting()||(K1e(this.coords.start,this.coords.cur),K1e(this.coords.prev,this.coords.cur),this.downEvent=t,this.pointerWasMoved=!1)),this._updateLatestPointer(e,t,i),this._scopeFire("interactions:update-pointer",{pointer:e,event:t,eventTarget:i,down:s,pointerInfo:a,pointerIndex:o,interaction:this}),o}removePointer(e,t){const i=this.getPointerIndex(e);if(i===-1)return;const s=this.pointers[i];this._scopeFire("interactions:remove-pointer",{pointer:e,event:t,eventTarget:null,pointerIndex:i,pointerInfo:s,interaction:this}),this.pointers.splice(i,1),this.pointerIsDown=!1}_updateLatestPointer(e,t,i){this._latestPointer.pointer=e,this._latestPointer.event=t,this._latestPointer.eventTarget=i}destroy(){this._latestPointer.pointer=null,this._latestPointer.event=null,this._latestPointer.eventTarget=null}_createPreparedEvent(e,t,i,s){return new q1e(this,e,this.prepared.name,t,this.element,i,s)}_fireEvent(e){var t;(t=this.interactable)==null||t.fire(e),(!this.prevEvent||e.timeStamp>=this.prevEvent.timeStamp)&&(this.prevEvent=e)}_doPhase(e){const{event:t,phase:i,preEnd:s,type:r}=e,{rect:o}=this;if(o&&i==="move"&&(z1e(this.edges,o,this.coords.delta[this.interactable.options.deltaSource]),o.width=o.right-o.left,o.height=o.bottom-o.top),this._scopeFire(`interactions:before-action-${i}`,e)===!1)return!1;const a=e.iEvent=this._createPreparedEvent(t,i,s,r);return this._scopeFire(`interactions:action-${i}`,e),i==="start"&&(this.prevEvent=a),this._fireEvent(a),this._scopeFire(`interactions:after-action-${i}`,e),!0}_now(){return Date.now()}}const tjn=ejn;function njn(n){return/^(always|never|auto)$/.test(n)?(this.options.preventDefault=n,this):ut.bool(n)?(this.options.preventDefault=n?"always":"never",this):this.options.preventDefault}function ijn(n,e,t){const i=n.options.preventDefault;if(i!=="never"){if(i==="always"){t.preventDefault();return}if(e.events.supportsPassive&&/^touch(start|move)$/.test(t.type)){const s=rx(t.target).document,r=e.getDocOptions(s);if(!(r&&r.events)||r.events.passive!==!1)return}/^(mouse|pointer|touch)*(down|start)/i.test(t.type)||ut.element(t.target)&&ax(t.target,"input,select,textarea,[contenteditable=true],[contenteditable=true] *")||t.preventDefault()}}function sjn({interaction:n,event:e}){n.interactable&&n.interactable.checkAndPreventDefault(e)}function rjn(n){const{Interactable:e}=n;e.prototype.preventDefault=njn,e.prototype.checkAndPreventDefault=function(t){return ijn(this,n,t)},n.interactions.docEvents.push({type:"dragstart",listener(t){for(const i of n.interactions.list)if(i.element&&(i.element===t.target||ox(i.element,t.target))){i.interactable.checkAndPreventDefault(t);return}}})}const ojn={id:"core/interactablePreventDefault",install:rjn,listeners:["down","move","up","cancel"].reduce((n,e)=>(n[`interactions:${e}`]=sjn,n),{})},Z1e={methodOrder:["simulationResume","mouseOrPen","hasPointer","idle"],search(n){for(const e of Z1e.methodOrder){const t=Z1e[e](n);if(t)return t}return null},simulationResume({pointerType:n,eventType:e,eventTarget:t,scope:i}){if(!/down|start/i.test(e))return null;for(const s of i.interactions.list){let r=t;if(s.simulation&&s.simulation.allowResume&&s.pointerType===n)for(;r;){if(r===s.element)return s;r=I0(r)}}return null},mouseOrPen({pointerId:n,pointerType:e,eventType:t,scope:i}){if(e!=="mouse"&&e!=="pen")return null;let s;for(const r of i.interactions.list)if(r.pointerType===e){if(r.simulation&&!qlt(r,n))continue;if(r.interacting())return r;s||(s=r)}if(s)return s;for(const r of i.interactions.list)if(r.pointerType===e&&!(/down/i.test(t)&&r.simulation))return r;return null},hasPointer({pointerId:n,scope:e}){for(const t of e.interactions.list)if(qlt(t,n))return t;return null},idle({pointerType:n,scope:e}){for(const t of e.interactions.list){if(t.pointers.length===1){const i=t.interactable;if(i&&!(i.options.gesture&&i.options.gesture.enabled))continue}else if(t.pointers.length>=2)continue;if(!t.interacting()&&n===t.pointerType)return t}return null}};function qlt(n,e){return n.pointers.some(({id:t})=>t===e)}const ajn=Z1e,Klt=["pointerDown","pointerMove","pointerUp","updatePointer","removePointer","windowBlur"];function ljn(n){const e={};for(const r of Klt)e[r]=jlt(r,n);const t=Bp.pEventTypes;let i;Uu.PointerEvent?i=[{type:t.down,listener:s},{type:t.down,listener:e.pointerDown},{type:t.move,listener:e.pointerMove},{type:t.up,listener:e.pointerUp},{type:t.cancel,listener:e.pointerUp}]:i=[{type:"mousedown",listener:e.pointerDown},{type:"mousemove",listener:e.pointerMove},{type:"mouseup",listener:e.pointerUp},{type:"touchstart",listener:s},{type:"touchstart",listener:e.pointerDown},{type:"touchmove",listener:e.pointerMove},{type:"touchend",listener:e.pointerUp},{type:"touchcancel",listener:e.pointerUp}],i.push({type:"blur",listener(r){for(const o of n.interactions.list)o.documentBlur(r)}}),n.prevTouchTime=0,n.Interaction=class extends tjn{get pointerMoveTolerance(){return n.interactions.pointerMoveTolerance}set pointerMoveTolerance(r){n.interactions.pointerMoveTolerance=r}_now(){return n.now()}},n.interactions={list:[],new(r){r.scopeFire=(a,l)=>n.fire(a,l);const o=new n.Interaction(r);return n.interactions.list.push(o),o},listeners:e,docEvents:i,pointerMoveTolerance:1};function s(){for(const r of n.interactions.list)if(!(!r.pointerIsDown||r.pointerType!=="touch"||r._interacting))for(const o of r.pointers)n.documents.some(({doc:a})=>ox(a,o.downTarget))||r.removePointer(o.pointer,o.event)}n.usePlugin(ojn)}function jlt(n,e){return function(t){const i=e.interactions.list,s=QKn(t),[r,o]=Qlt(t),a=[];if(/^touch/.test(t.type)){e.prevTouchTime=e.now();for(const l of t.changedTouches){const c=l,d=TG(c),u={pointer:c,pointerId:d,pointerType:s,eventType:t.type,eventTarget:r,curEventTarget:o,scope:e},f=Glt(u);a.push([u.pointer,u.eventTarget,u.curEventTarget,f])}}else{let l=!1;if(!Bp.supportsPointerEvent&&/mouse/.test(t.type)){for(let c=0;c<i.length&&!l;c++)l=i[c].pointerType!=="mouse"&&i[c].pointerIsDown;l=l||e.now()-e.prevTouchTime<500||t.timeStamp===0}if(!l){const c={pointer:t,pointerId:TG(t),pointerType:s,eventType:t.type,curEventTarget:o,eventTarget:r,scope:e},d=Glt(c);a.push([c.pointer,c.eventTarget,c.curEventTarget,d])}}for(const[l,c,d,u]of a)u[n](l,t,c,d)}}function Glt(n){const{pointerType:e,scope:t}=n,i={interaction:ajn.search(n),searchDetails:n};return t.fire("interactions:find",i),i.interaction||t.interactions.new({pointerType:e})}function J1e({doc:n,scope:e,options:t},i){const{interactions:{docEvents:s},events:r}=e,o=r[i];e.browser.isIOS&&!t.events&&(t.events={passive:!1});for(const l in r.delegatedEvents)o(n,l,r.delegateListener),o(n,l,r.delegateUseCapture,!0);const a=t&&t.events;for(const{type:l,listener:c}of s)o(n,l,c,a)}const cjn={id:"core/interactions",install:ljn,listeners:{"scope:add-document":n=>J1e(n,"add"),"scope:remove-document":n=>J1e(n,"remove"),"interactable:unset":({interactable:n},e)=>{for(let t=e.interactions.list.length-1;t>=0;t--){const i=e.interactions.list[t];i.interactable===n&&(i.stop(),e.fire("interactions:destroy",{interaction:i}),i.destroy(),e.interactions.list.length>2&&e.interactions.list.splice(t,1))}}},onDocSignal:J1e,doOnInteractions:jlt,methodNames:Klt},djn=cjn;class ujn{constructor(){at(this,"id",`__interact_scope_${Math.floor(Math.random()*100)}`),at(this,"isInitialized",!1),at(this,"listenerMaps",[]),at(this,"browser",Bp),at(this,"defaults",oR(Hlt)),at(this,"Eventable",Olt),at(this,"actions",{map:{},phases:{start:!0,move:!0,end:!0},methodDict:{},phaselessTypes:{}}),at(this,"interactStatic",qKn(this)),at(this,"InteractEvent",q1e),at(this,"Interactable"),at(this,"interactables",new jKn(this)),at(this,"_win"),at(this,"document"),at(this,"window"),at(this,"documents",[]),at(this,"_plugins",{list:[],map:{}}),at(this,"onWindowUnload",t=>this.removeDocument(t.target));const e=this;this.Interactable=class extends KKn{get _defaults(){return e.defaults}set(t){return super.set(t),e.fire("interactable:set",{options:t,interactable:this}),this}unset(){super.unset();const t=e.interactables.list.indexOf(this);t<0||(super.unset(),e.interactables.list.splice(t,1),e.fire("interactable:unset",{interactable:this}))}}}addListeners(e,t){this.listenerMaps.push({id:t,map:e})}fire(e,t){for(const{map:{[e]:i}}of this.listenerMaps)if(i&&i(t,this,e)===!1)return!1}init(e){return this.isInitialized?this:hjn(this,e)}pluginIsInstalled(e){return this._plugins.map[e.id]||this._plugins.list.indexOf(e)!==-1}usePlugin(e,t){if(!this.isInitialized)return this;if(this.pluginIsInstalled(e))return this;if(e.id&&(this._plugins.map[e.id]=e),this._plugins.list.push(e),e.install&&e.install(this,t),e.listeners&&e.before){let i=0;const s=this.listenerMaps.length,r=e.before.reduce((o,a)=>(o[a]=!0,o[Ylt(a)]=!0,o),{});for(;i<s;i++){const o=this.listenerMaps[i].id;if(r[o]||r[Ylt(o)])break}this.listenerMaps.splice(i,0,{id:e.id,map:e.listeners})}else e.listeners&&this.listenerMaps.push({id:e.id,map:e.listeners});return this}addDocument(e,t){if(this.getDocIndex(e)!==-1)return!1;const i=rx(e);t=t?In({},t):{},this.documents.push({doc:e,options:t}),this.events.documents.push(e),e!==this.document&&this.events.add(i,"unload",this.onWindowUnload),this.fire("scope:add-document",{doc:e,window:i,scope:this,options:t})}removeDocument(e){const t=this.getDocIndex(e),i=rx(e),s=this.documents[t].options;this.events.remove(i,"unload",this.onWindowUnload),this.documents.splice(t,1),this.events.documents.splice(t,1),this.fire("scope:remove-document",{doc:e,window:i,scope:this,options:s})}getDocIndex(e){for(let t=0;t<this.documents.length;t++)if(this.documents[t].doc===e)return t;return-1}getDocOptions(e){const t=this.getDocIndex(e);return t===-1?null:this.documents[t].options}now(){return(this.window.Date||Date).now()}}function hjn(n,e){return n.isInitialized=!0,ut.window(e)&&wlt(e),Uu.init(e),Bp.init(e),aR.init(e),n.window=e,n.document=e.document,n.usePlugin(djn),n.usePlugin(XKn),n}function Ylt(n){return n&&n.replace(/\/.*$/,"")}const Xlt=new ujn,fjn=Xlt.interactStatic,p_=fjn,gjn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:globalThis;Xlt.init(gjn),p_.use(NKn);function pjn(n){const{defaults:e,actions:t}=n;n.autoScroll=ei,ei.now=()=>n.now(),t.phaselessTypes.autoscroll=!0,e.perAction.autoScroll=ei.defaults}const ei={defaults:{enabled:!1,margin:60,container:null,speed:300},now:Date.now,interaction:null,i:0,x:0,y:0,isScrolling:!1,prevTime:0,margin:0,speed:0,start(n){ei.isScrolling=!0,aR.cancel(ei.i),n.autoScroll=ei,ei.interaction=n,ei.prevTime=ei.now(),ei.i=aR.request(ei.scroll)},stop(){ei.isScrolling=!1,ei.interaction&&(ei.interaction.autoScroll=null),aR.cancel(ei.i)},scroll(){const{interaction:n}=ei,{interactable:e,element:t}=n,i=n.prepared.name,s=e.options[i].autoScroll,r=Zlt(s.container,e,t),o=ei.now(),a=(o-ei.prevTime)/1e3,l=s.speed*a;if(l>=1){const c={x:ei.x*l,y:ei.y*l};if(c.x||c.y){const d=Jlt(r);ut.window(r)?r.scrollBy(c.x,c.y):r&&(r.scrollLeft+=c.x,r.scrollTop+=c.y);const u=Jlt(r),f={x:u.x-d.x,y:u.y-d.y};(f.x||f.y)&&e.fire({type:"autoscroll",target:t,interactable:e,delta:f,interaction:n,container:r})}ei.prevTime=o}ei.isScrolling&&(aR.cancel(ei.i),ei.i=aR.request(ei.scroll))},check(n,e){var t;return(t=n.options[e].autoScroll)==null?void 0:t.enabled},onInteractionMove({interaction:n,pointer:e}){if(!(n.interacting()&&ei.check(n.interactable,n.prepared.name)))return;if(n.simulation){ei.x=ei.y=0;return}let t,i,s,r;const{interactable:o,element:a}=n,l=n.prepared.name,c=o.options[l].autoScroll,d=Zlt(c.container,o,a);if(ut.window(d))r=e.clientX<ei.margin,t=e.clientY<ei.margin,i=e.clientX>d.innerWidth-ei.margin,s=e.clientY>d.innerHeight-ei.margin;else{const u=P1e(d);r=e.clientX<u.left+ei.margin,t=e.clientY<u.top+ei.margin,i=e.clientX>u.right-ei.margin,s=e.clientY>u.bottom-ei.margin}ei.x=i?1:r?-1:0,ei.y=s?1:t?-1:0,ei.isScrolling||(ei.margin=c.margin,ei.speed=c.speed,ei.start(n))}};function Zlt(n,e,t){return(ut.string(n)?Plt(n,e,t):n)||rx(t)}function Jlt(n){return ut.window(n)&&(n=window.document.body),{x:n.scrollLeft,y:n.scrollTop}}const mjn={id:"auto-scroll",install:pjn,listeners:{"interactions:new":({interaction:n})=>{n.autoScroll=null},"interactions:destroy":({interaction:n})=>{n.autoScroll=null,ei.stop(),ei.interaction&&(ei.interaction=null)},"interactions:stop":ei.stop,"interactions:action-move":n=>ei.onInteractionMove(n)}},Ajn=mjn;p_.use(Ajn);function bjn(n){const{actions:e,Interactable:t,defaults:i}=n;t.prototype.draggable=LG.draggable,e.map.drag=LG,e.methodDict.drag="draggable",i.actions.drag=LG.defaults}function eSe({interaction:n}){if(n.prepared.name!=="drag")return;const e=n.prepared.axis;e==="x"?(n.coords.cur.page.y=n.coords.start.page.y,n.coords.cur.client.y=n.coords.start.client.y,n.coords.velocity.client.y=0,n.coords.velocity.page.y=0):e==="y"&&(n.coords.cur.page.x=n.coords.start.page.x,n.coords.cur.client.x=n.coords.start.client.x,n.coords.velocity.client.x=0,n.coords.velocity.page.x=0)}function ect({iEvent:n,interaction:e}){if(e.prepared.name!=="drag")return;const t=e.prepared.axis;if(t==="x"||t==="y"){const i=t==="x"?"y":"x";n.page[i]=e.coords.start.page[i],n.client[i]=e.coords.start.client[i],n.delta[i]=0}}const yjn=function(n){return ut.object(n)?(this.options.drag.enabled=n.enabled!==!1,this.setPerAction("drag",n),this.setOnEvents("drag",n),/^(xy|x|y|start)$/.test(n.lockAxis)&&(this.options.drag.lockAxis=n.lockAxis),/^(xy|x|y)$/.test(n.startAxis)&&(this.options.drag.startAxis=n.startAxis),this):ut.bool(n)?(this.options.drag.enabled=n,this):this.options.drag},LG={id:"actions/drag",install:bjn,listeners:{"interactions:before-action-move":eSe,"interactions:action-resume":eSe,"interactions:action-move":ect,"auto-start:check":n=>{const{interaction:e,interactable:t,buttons:i}=n,s=t.options.drag;if(!(!(s&&s.enabled)||e.pointerIsDown&&/mouse|pointer/.test(e.pointerType)&&(i&t.options.drag.mouseButtons)===0))return n.action={name:"drag",axis:s.lockAxis==="start"?s.startAxis:s.lockAxis},!1}},draggable:yjn,beforeMove:eSe,move:ect,defaults:{startAxis:"xy",lockAxis:"xy"},getCursor(){return"move"}},_jn=LG;p_.use(_jn);function wjn(n){const{actions:e,browser:t,Interactable:i,defaults:s}=n;m_.cursors=Ejn(t),m_.defaultMargin=t.supportsTouch||t.supportsPointerEvent?20:10,i.prototype.resizable=function(r){return vjn(this,r,n)},e.map.resize=m_,e.methodDict.resize="resizable",s.actions.resize=m_.defaults}function Cjn(n){const{interaction:e,interactable:t,element:i,rect:s,buttons:r}=n;if(!s)return;const o=In({},e.coords.cur.page),a=t.options.resize;if(!(!(a&&a.enabled)||e.pointerIsDown&&/mouse|pointer/.test(e.pointerType)&&(r&a.mouseButtons)===0)){if(ut.object(a.edges)){const l={left:!1,right:!1,top:!1,bottom:!1};for(const c in l)l[c]=Sjn(c,a.edges[c],o,e._latestPointer.eventTarget,i,s,a.margin||m_.defaultMargin);l.left=l.left&&!l.right,l.top=l.top&&!l.bottom,(l.left||l.right||l.top||l.bottom)&&(n.action={name:"resize",edges:l})}else{const l=a.axis!=="y"&&o.x>s.right-m_.defaultMargin,c=a.axis!=="x"&&o.y>s.bottom-m_.defaultMargin;(l||c)&&(n.action={name:"resize",axes:(l?"x":"")+(c?"y":"")})}return n.action?!1:void 0}}function vjn(n,e,t){return ut.object(e)?(n.options.resize.enabled=e.enabled!==!1,n.setPerAction("resize",e),n.setOnEvents("resize",e),ut.string(e.axis)&&/^x$|^y$|^xy$/.test(e.axis)?n.options.resize.axis=e.axis:e.axis===null&&(n.options.resize.axis=t.defaults.actions.resize.axis),ut.bool(e.preserveAspectRatio)?n.options.resize.preserveAspectRatio=e.preserveAspectRatio:ut.bool(e.square)&&(n.options.resize.square=e.square),n):ut.bool(e)?(n.options.resize.enabled=e,n):n.options.resize}function Sjn(n,e,t,i,s,r,o){if(!e)return!1;if(e===!0){const a=ut.number(r.width)?r.width:r.right-r.left,l=ut.number(r.height)?r.height:r.bottom-r.top;if(o=Math.min(o,Math.abs((n==="left"||n==="right"?a:l)/2)),a<0&&(n==="left"?n="right":n==="right"&&(n="left")),l<0&&(n==="top"?n="bottom":n==="bottom"&&(n="top")),n==="left"){const c=a>=0?r.left:r.right;return t.x<c+o}if(n==="top"){const c=l>=0?r.top:r.bottom;return t.y<c+o}if(n==="right")return t.x>(a>=0?r.right:r.left)-o;if(n==="bottom")return t.y>(l>=0?r.bottom:r.top)-o}return ut.element(i)?ut.element(e)?e===i:O1e(i,e,s):!1}function Ejn(n){return n.isIe9?{x:"e-resize",y:"s-resize",xy:"se-resize",top:"n-resize",left:"w-resize",bottom:"s-resize",right:"e-resize",topleft:"se-resize",bottomright:"se-resize",topright:"ne-resize",bottomleft:"ne-resize"}:{x:"ew-resize",y:"ns-resize",xy:"nwse-resize",top:"ns-resize",left:"ew-resize",bottom:"ns-resize",right:"ew-resize",topleft:"nwse-resize",bottomright:"nwse-resize",topright:"nesw-resize",bottomleft:"nesw-resize"}}function xjn({iEvent:n,interaction:e}){if(e.prepared.name!=="resize"||!e.prepared.edges)return;const t=n,i=e.rect;e._rects={start:In({},i),corrected:In({},i),previous:In({},i),delta:{left:0,right:0,width:0,top:0,bottom:0,height:0}},t.edges=e.prepared.edges,t.rect=e._rects.corrected,t.deltaRect=e._rects.delta}function kjn({iEvent:n,interaction:e}){if(e.prepared.name!=="resize"||!e.prepared.edges)return;const t=n,i=e.interactable.options.resize.invert,s=i==="reposition"||i==="negate",r=e.rect,{start:o,corrected:a,delta:l,previous:c}=e._rects;if(In(c,a),s){if(In(a,r),i==="reposition"){if(a.top>a.bottom){const d=a.top;a.top=a.bottom,a.bottom=d}if(a.left>a.right){const d=a.left;a.left=a.right,a.right=d}}}else a.top=Math.min(r.top,o.bottom),a.bottom=Math.max(r.bottom,o.top),a.left=Math.min(r.left,o.right),a.right=Math.max(r.right,o.left);a.width=a.right-a.left,a.height=a.bottom-a.top;for(const d in a)l[d]=a[d]-c[d];t.edges=e.prepared.edges,t.rect=a,t.deltaRect=l}function Tjn({iEvent:n,interaction:e}){if(e.prepared.name!=="resize"||!e.prepared.edges)return;const t=n;t.edges=e.prepared.edges,t.rect=e._rects.corrected,t.deltaRect=e._rects.delta}function tct({iEvent:n,interaction:e}){if(e.prepared.name!=="resize"||!e.resizeAxes)return;const t=e.interactable.options,i=n;t.resize.square?(e.resizeAxes==="y"?i.delta.x=i.delta.y:i.delta.y=i.delta.x,i.axes="xy"):(i.axes=e.resizeAxes,e.resizeAxes==="x"?i.delta.y=0:e.resizeAxes==="y"&&(i.delta.x=0))}const m_={id:"actions/resize",before:["actions/drag"],install:wjn,listeners:{"interactions:new":({interaction:n})=>{n.resizeAxes="xy"},"interactions:action-start":n=>{xjn(n),tct(n)},"interactions:action-move":n=>{kjn(n),tct(n)},"interactions:action-end":Tjn,"auto-start:check":Cjn},defaults:{square:!1,preserveAspectRatio:!1,axis:"xy",margin:NaN,edges:null,invert:"none"},cursors:null,getCursor({edges:n,axis:e,name:t}){const i=m_.cursors;let s=null;if(e)s=i[t+e];else if(n){let r="";for(const o of["top","bottom","left","right"])n[o]&&(r+=o);s=i[r]}return s},defaultMargin:null},Ljn=m_;p_.use(Ljn);const Ijn=()=>{},Djn=()=>{},Njn=n=>{const e=[["x","y"],["left","top"],["right","bottom"],["width","height"]].filter(([i,s])=>i in n||s in n),t=(i,s)=>{const{range:r,limits:o={left:-1/0,right:1/0,top:-1/0,bottom:1/0},offset:a={x:0,y:0}}=n,l={range:r,grid:n,x:null,y:null};for(const[c,d]of e){const u=Math.round((i-a.x)/n[c]),f=Math.round((s-a.y)/n[d]);l[c]=Math.max(o.left,Math.min(o.right,u*n[c]+a.x)),l[d]=Math.max(o.top,Math.min(o.bottom,f*n[d]+a.y))}return l};return t.grid=n,t.coordFields=e,t},Rjn=Object.freeze(Object.defineProperty({__proto__:null,edgeTarget:Ijn,elements:Djn,grid:Njn},Symbol.toStringTag,{value:"Module"})),Mjn={id:"snappers",install(n){const{interactStatic:e}=n;e.snappers=In(e.snappers||{},Rjn),e.createSnapGrid=e.snappers.grid}},Bjn=Mjn;class nct{constructor(e){at(this,"states",[]),at(this,"startOffset",{left:0,right:0,top:0,bottom:0}),at(this,"startDelta"),at(this,"result"),at(this,"endResult"),at(this,"startEdges"),at(this,"edges"),at(this,"interaction"),this.interaction=e,this.result=IG(),this.edges={left:!1,right:!1,top:!1,bottom:!1}}start({phase:e},t){const{interaction:i}=this,s=Fjn(i);this.prepareStates(s),this.startEdges=In({},i.edges),this.edges=In({},this.startEdges),this.startOffset=Ojn(i.rect,t),this.startDelta={x:0,y:0};const r=this.fillArg({phase:e,pageCoords:t,preEnd:!1});return this.result=IG(),this.startAll(r),this.result=this.setAll(r)}fillArg(e){const{interaction:t}=this;return e.interaction=t,e.interactable=t.interactable,e.element=t.element,e.rect||(e.rect=t.rect),e.edges||(e.edges=this.startEdges),e.startOffset=this.startOffset,e}startAll(e){for(const t of this.states)t.methods.start&&(e.state=t,t.methods.start(e))}setAll(e){const{phase:t,preEnd:i,skipModifiers:s,rect:r,edges:o}=e;e.coords=In({},e.pageCoords),e.rect=In({},r),e.edges=In({},o);const a=s?this.states.slice(s):this.states,l=IG(e.coords,e.rect);for(const f of a){var c;const{options:g}=f,p=In({},e.coords);let m=null;(c=f.methods)!=null&&c.set&&this.shouldDo(g,i,t)&&(e.state=f,m=f.methods.set(e),z1e(e.edges,e.rect,{x:e.coords.x-p.x,y:e.coords.y-p.y})),l.eventProps.push(m)}In(this.edges,e.edges),l.delta.x=e.coords.x-e.pageCoords.x,l.delta.y=e.coords.y-e.pageCoords.y,l.rectDelta.left=e.rect.left-r.left,l.rectDelta.right=e.rect.right-r.right,l.rectDelta.top=e.rect.top-r.top,l.rectDelta.bottom=e.rect.bottom-r.bottom;const d=this.result.coords,u=this.result.rect;if(d&&u){const f=l.rect.left!==u.left||l.rect.right!==u.right||l.rect.top!==u.top||l.rect.bottom!==u.bottom;l.changed=f||d.x!==l.coords.x||d.y!==l.coords.y}return l}applyToInteraction(e){const{interaction:t}=this,{phase:i}=e,s=t.coords.cur,r=t.coords.start,{result:o,startDelta:a}=this,l=o.delta;i==="start"&&In(this.startDelta,o.delta);for(const[u,f]of[[r,a],[s,l]])u.page.x+=f.x,u.page.y+=f.y,u.client.x+=f.x,u.client.y+=f.y;const{rectDelta:c}=this.result,d=e.rect||t.rect;d.left+=c.left,d.right+=c.right,d.top+=c.top,d.bottom+=c.bottom,d.width=d.right-d.left,d.height=d.bottom-d.top}setAndApply(e){const{interaction:t}=this,{phase:i,preEnd:s,skipModifiers:r}=e,o=this.setAll(this.fillArg({preEnd:s,phase:i,pageCoords:e.modifiedCoords||t.coords.cur.page}));if(this.result=o,!o.changed&&(!r||r<this.states.length)&&t.interacting())return!1;if(e.modifiedCoords){const{page:a}=t.coords.cur,l={x:e.modifiedCoords.x-a.x,y:e.modifiedCoords.y-a.y};o.coords.x+=l.x,o.coords.y+=l.y,o.delta.x+=l.x,o.delta.y+=l.y}this.applyToInteraction(e)}beforeEnd(e){const{interaction:t,event:i}=e,s=this.states;if(!s||!s.length)return;let r=!1;for(const o of s){e.state=o;const{options:a,methods:l}=o,c=l.beforeEnd&&l.beforeEnd(e);if(c)return this.endResult=c,!1;r=r||!r&&this.shouldDo(a,!0,e.phase,!0)}r&&t.move({event:i,preEnd:!0})}stop(e){const{interaction:t}=e;if(!this.states||!this.states.length)return;const i=In({states:this.states,interactable:t.interactable,element:t.element,rect:null},e);this.fillArg(i);for(const s of this.states)i.state=s,s.methods.stop&&s.methods.stop(i);this.states=null,this.endResult=null}prepareStates(e){this.states=[];for(let t=0;t<e.length;t++){const{options:i,methods:s,name:r}=e[t];this.states.push({options:i,methods:s,index:t,name:r})}return this.states}restoreInteractionCoords({interaction:{coords:e,rect:t,modification:i}}){if(!i.result)return;const{startDelta:s}=i,{delta:r,rectDelta:o}=i.result,a=[[e.start,s],[e.cur,r]];for(const[l,c]of a)l.page.x-=c.x,l.page.y-=c.y,l.client.x-=c.x,l.client.y-=c.y;t.left-=o.left,t.right-=o.right,t.top-=o.top,t.bottom-=o.bottom}shouldDo(e,t,i,s){return!(!e||e.enabled===!1||s&&!e.endOnly||e.endOnly&&!t||i==="start"&&!e.setStart)}copyFrom(e){this.startOffset=e.startOffset,this.startDelta=e.startDelta,this.startEdges=e.startEdges,this.edges=e.edges,this.states=e.states.map(t=>oR(t)),this.result=IG(In({},e.result.coords),In({},e.result.rect))}destroy(){for(const e in this)this[e]=null}}function IG(n,e){return{rect:e,coords:n,delta:{x:0,y:0},rectDelta:{left:0,right:0,top:0,bottom:0},eventProps:[],changed:!0}}function Fjn(n){const e=n.interactable.options[n.prepared.name],t=e.modifiers;return t&&t.length?t:["snap","snapSize","snapEdges","restrict","restrictEdges","restrictSize"].map(i=>{const s=e[i];return s&&s.enabled&&{options:s,methods:s._methods}}).filter(i=>!!i)}function Ojn(n,e){return n?{left:e.x-n.left,top:e.y-n.top,right:n.right-e.x,bottom:n.bottom-e.y}:{left:0,top:0,right:0,bottom:0}}function D0(n,e){const{defaults:t}=n,i={start:n.start,set:n.set,beforeEnd:n.beforeEnd,stop:n.stop},s=r=>{const o=r||{};o.enabled=o.enabled!==!1;for(const l in t)l in o||(o[l]=t[l]);const a={options:o,methods:i,name:e,enable:()=>(o.enabled=!0,a),disable:()=>(o.enabled=!1,a)};return a};return e&&typeof e=="string"&&(s._defaults=t,s._methods=i),s}function tSe({iEvent:n,interaction:e}){const t=e.modification.result;t&&(n.modifiers=t.eventProps)}const Pjn={id:"modifiers/base",before:["actions"],install:n=>{n.defaults.perAction.modifiers=[]},listeners:{"interactions:new":({interaction:n})=>{n.modification=new nct(n)},"interactions:before-action-start":n=>{const{interaction:e}=n,t=n.interaction.modification;t.start(n,e.coords.start.page),e.edges=t.edges,t.applyToInteraction(n)},"interactions:before-action-move":n=>{const{interaction:e}=n,{modification:t}=e,i=t.setAndApply(n);return e.edges=t.edges,i},"interactions:before-action-end":n=>{const{interaction:e}=n,{modification:t}=e,i=t.beforeEnd(n);return e.edges=t.startEdges,i},"interactions:action-start":tSe,"interactions:action-move":tSe,"interactions:action-end":tSe,"interactions:after-action-start":n=>n.interaction.modification.restoreInteractionCoords(n),"interactions:after-action-move":n=>n.interaction.modification.restoreInteractionCoords(n),"interactions:stop":n=>n.interaction.modification.stop(n)}},Vjn=Pjn,Ujn={start(n){const{state:e,rect:t,edges:i,pageCoords:s}=n;let{ratio:r,enabled:o}=e.options;const{equalDelta:a,modifiers:l}=e.options;r==="preserve"&&(r=t.width/t.height),e.startCoords=In({},s),e.startRect=In({},t),e.ratio=r,e.equalDelta=a;const c=e.linkedEdges={top:i.top||i.left&&!i.bottom,left:i.left||i.top&&!i.right,bottom:i.bottom||i.right&&!i.top,right:i.right||i.bottom&&!i.left};if(e.xIsPrimaryAxis=!!(i.left||i.right),e.equalDelta){const u=(c.left?1:-1)*(c.top?1:-1);e.edgeSign={x:u,y:u}}else e.edgeSign={x:c.left?-1:1,y:c.top?-1:1};if(o!==!1&&In(i,c),!(l!=null&&l.length))return;const d=new nct(n.interaction);d.copyFrom(n.interaction.modification),d.prepareStates(l),e.subModification=d,d.startAll({...n})},set(n){const{state:e,rect:t,coords:i}=n,{linkedEdges:s}=e,r=In({},i),o=e.equalDelta?Hjn:$jn;if(In(n.edges,s),o(e,e.xIsPrimaryAxis,i,t),!e.subModification)return null;const a=In({},t);z1e(s,a,{x:i.x-r.x,y:i.y-r.y});const l=e.subModification.setAll({...n,rect:a,edges:s,pageCoords:i,prevCoords:i,prevRect:a}),{delta:c}=l;if(l.changed){const d=Math.abs(c.x)>Math.abs(c.y);o(e,d,l.coords,l.rect),In(i,l.coords)}return l.eventProps},defaults:{ratio:"preserve",equalDelta:!1,modifiers:[],enabled:!1}};function Hjn({startCoords:n,edgeSign:e},t,i){t?i.y=n.y+(i.x-n.x)*e.y:i.x=n.x+(i.y-n.y)*e.x}function $jn({startRect:n,startCoords:e,ratio:t,edgeSign:i},s,r,o){if(s){const a=o.width/t;r.y=e.y+(a-n.height)*i.y}else{const a=o.height*t;r.x=e.x+(a-n.width)*i.x}}const Wjn=D0(Ujn,"aspectRatio"),ict=()=>{};ict._defaults={};const DG=ict;function zjn({rect:n,startOffset:e,state:t,interaction:i,pageCoords:s}){const{options:r}=t,{elementRect:o}=r,a=In({left:0,top:0,right:0,bottom:0},r.offset||{});if(n&&o){const l=cx(r.restriction,i,s);if(l){const c=l.right-l.left-n.width,d=l.bottom-l.top-n.height;c<0&&(a.left+=c,a.right+=c),d<0&&(a.top+=d,a.bottom+=d)}a.left+=e.left-n.width*o.left,a.top+=e.top-n.height*o.top,a.right+=e.right-n.width*(1-o.right),a.bottom+=e.bottom-n.height*(1-o.bottom)}t.offset=a}function Qjn({coords:n,interaction:e,state:t}){const{options:i,offset:s}=t,r=cx(i.restriction,e,n);if(!r)return;const o=BKn(r);n.x=Math.max(Math.min(o.right-s.right,n.x),o.left+s.left),n.y=Math.max(Math.min(o.bottom-s.bottom,n.y),o.top+s.top)}function cx(n,e,t){return ut.func(n)?tV(n,e.interactable,e.element,[t.x,t.y,e]):tV(n,e.interactable,e.element)}const qjn={restriction:null,elementRect:null,offset:null,endOnly:!1,enabled:!1},NG={start:zjn,set:Qjn,defaults:qjn},Kjn=D0(NG,"restrict"),sct={top:1/0,left:1/0,bottom:-1/0,right:-1/0},rct={top:-1/0,left:-1/0,bottom:1/0,right:1/0};function jjn({interaction:n,startOffset:e,state:t}){const{options:i}=t;let s;if(i){const r=cx(i.offset,n,n.coords.start.page);s=EG(r)}s=s||{x:0,y:0},t.offset={top:s.y+e.top,left:s.x+e.left,bottom:s.y-e.bottom,right:s.x-e.right}}function Gjn({coords:n,edges:e,interaction:t,state:i}){const{offset:s,options:r}=i;if(!e)return;const o=In({},n),a=cx(r.inner,t,o)||{},l=cx(r.outer,t,o)||{};oct(a,sct),oct(l,rct),e.top?n.y=Math.min(Math.max(l.top+s.top,o.y),a.top+s.top):e.bottom&&(n.y=Math.max(Math.min(l.bottom+s.bottom,o.y),a.bottom+s.bottom)),e.left?n.x=Math.min(Math.max(l.left+s.left,o.x),a.left+s.left):e.right&&(n.x=Math.max(Math.min(l.right+s.right,o.x),a.right+s.right))}function oct(n,e){for(const t of["top","left","bottom","right"])t in n||(n[t]=e[t]);return n}const Yjn={inner:null,outer:null,offset:null,endOnly:!1,enabled:!1},sV={noInner:sct,noOuter:rct,start:jjn,set:Gjn,defaults:Yjn},Xjn=D0(sV,"restrictEdges"),Zjn=In({get elementRect(){return{top:0,left:0,bottom:1,right:1}},set elementRect(n){}},NG.defaults),Jjn={start:NG.start,set:NG.set,defaults:Zjn},eGn=D0(Jjn,"restrictRect"),tGn={width:-1/0,height:-1/0},nGn={width:1/0,height:1/0};function iGn(n){return sV.start(n)}function sGn(n){const{interaction:e,state:t,rect:i,edges:s}=n,{options:r}=t;if(!s)return;const o=Vlt(cx(r.min,e,n.coords))||tGn,a=Vlt(cx(r.max,e,n.coords))||nGn;t.options={endOnly:r.endOnly,inner:In({},sV.noInner),outer:In({},sV.noOuter)},s.top?(t.options.inner.top=i.bottom-o.height,t.options.outer.top=i.bottom-a.height):s.bottom&&(t.options.inner.bottom=i.top+o.height,t.options.outer.bottom=i.top+a.height),s.left?(t.options.inner.left=i.right-o.width,t.options.outer.left=i.right-a.width):s.right&&(t.options.inner.right=i.left+o.width,t.options.outer.right=i.left+a.width),sV.set(n),t.options=r}const rGn={min:null,max:null,endOnly:!1,enabled:!1},oGn={start:iGn,set:sGn,defaults:rGn},aGn=D0(oGn,"restrictSize");function lGn(n){const{interaction:e,interactable:t,element:i,rect:s,state:r,startOffset:o}=n,{options:a}=r,l=a.offsetWithOrigin?dGn(n):{x:0,y:0};let c;if(a.offset==="startCoords")c={x:e.coords.start.page.x,y:e.coords.start.page.y};else{const u=tV(a.offset,t,i,[e]);c=EG(u)||{x:0,y:0},c.x+=l.x,c.y+=l.y}const{relativePoints:d}=a;r.offsets=s&&d&&d.length?d.map((u,f)=>({index:f,relativePoint:u,x:o.left-s.width*u.x+c.x,y:o.top-s.height*u.y+c.y})):[{index:0,relativePoint:null,x:c.x,y:c.y}]}function cGn(n){const{interaction:e,coords:t,state:i}=n,{options:s,offsets:r}=i,o=Q1e(e.interactable,e.element,e.prepared.name),a=In({},t),l=[];s.offsetWithOrigin||(a.x-=o.x,a.y-=o.y);for(const d of r){const u=a.x-d.x,f=a.y-d.y;for(let g=0,p=s.targets.length;g<p;g++){const m=s.targets[g];let A;ut.func(m)?A=m(u,f,e._proxy,d,g):A=m,A&&l.push({x:(ut.number(A.x)?A.x:u)+d.x,y:(ut.number(A.y)?A.y:f)+d.y,range:ut.number(A.range)?A.range:s.range,source:m,index:g,offset:d})}}const c={target:null,inRange:!1,distance:0,range:0,delta:{x:0,y:0}};for(const d of l){const u=d.range,f=d.x-a.x,g=d.y-a.y,p=xG(f,g);let m=p<=u;u===1/0&&c.inRange&&c.range!==1/0&&(m=!1),(!c.target||(m?c.inRange&&u!==1/0?p/u<c.distance/c.range:u===1/0&&c.range!==1/0||p<c.distance:!c.inRange&&p<c.distance))&&(c.target=d,c.distance=p,c.range=u,c.inRange=m,c.delta.x=f,c.delta.y=g)}return c.inRange&&(t.x=c.target.x,t.y=c.target.y),i.closest=c,c}function dGn(n){const{element:e}=n.interaction;return EG(tV(n.state.options.origin,null,null,[e]))||Q1e(n.interactable,e,n.interaction.prepared.name)}const uGn={range:1/0,targets:null,offset:null,offsetWithOrigin:!0,origin:null,relativePoints:null,endOnly:!1,enabled:!1},nSe={start:lGn,set:cGn,defaults:uGn},hGn=D0(nSe,"snap");function fGn(n){const{state:e,edges:t}=n,{options:i}=e;if(!t)return null;n.state={options:{targets:null,relativePoints:[{x:t.left?0:1,y:t.top?0:1}],offset:i.offset||"self",origin:{x:0,y:0},range:i.range}},e.targetFields=e.targetFields||[["width","height"],["x","y"]],nSe.start(n),e.offsets=n.state.offsets,n.state=e}function gGn(n){const{interaction:e,state:t,coords:i}=n,{options:s,offsets:r}=t,o={x:i.x-r[0].x,y:i.y-r[0].y};t.options=In({},s),t.options.targets=[];for(const l of s.targets||[]){let c;if(ut.func(l)?c=l(o.x,o.y,e):c=l,!!c){for(const[d,u]of t.targetFields)if(d in c||u in c){c.x=c[d],c.y=c[u];break}t.options.targets.push(c)}}const a=nSe.set(n);return t.options=s,a}const pGn={range:1/0,targets:null,offset:null,endOnly:!1,enabled:!1},RG={start:fGn,set:gGn,defaults:pGn},mGn=D0(RG,"snapSize");function AGn(n){const{edges:e}=n;return e?(n.state.targetFields=n.state.targetFields||[[e.left?"left":"right",e.top?"top":"bottom"]],RG.start(n)):null}const bGn={start:AGn,set:RG.set,defaults:In(oR(RG.defaults),{targets:null,range:null,offset:{x:0,y:0}})},yGn=D0(bGn,"snapEdges"),iSe={aspectRatio:Wjn,restrictEdges:Xjn,restrict:Kjn,restrictRect:eGn,restrictSize:aGn,snapEdges:yGn,snap:hGn,snapSize:mGn,spring:DG,avoid:DG,transform:DG,rubberband:DG},_Gn={id:"modifiers",install(n){const{interactStatic:e}=n;n.usePlugin(Vjn),n.usePlugin(Bjn),e.modifiers=iSe;for(const t in iSe){const{_defaults:i,_methods:s}=iSe[t];i._methods=s,n.defaults.perAction[t]=i}}},wGn=_Gn;p_.use(wGn);const CGn={};var cR;(function(n){n.touchAction="touchAction",n.boxSizing="boxSizing",n.noListeners="noListeners"})(cR||(cR={}));const act="[interact.js] ",sSe={touchAction:"https://developer.mozilla.org/en-US/docs/Web/CSS/touch-action",boxSizing:"https://developer.mozilla.org/en-US/docs/Web/CSS/box-sizing"};function vGn(n,{logger:e}={}){const{Interactable:t,defaults:i}=n;n.logger=e||console,i.base.devTools={ignore:{}},t.prototype.devTools=function(s){return s?(In(this.options.devTools,s),this):this.options.devTools},n.usePlugin(CGn)}const lct=[{name:cR.touchAction,perform({element:n}){return!SGn(n,"touchAction",/pan-|pinch|none/)},getInfo({element:n}){return[n,sSe.touchAction]},text:`Consider adding CSS "touch-action: none" to this element
2905
2905
  `},{name:cR.boxSizing,perform(n){const{element:e}=n;return n.prepared.name==="resize"&&e instanceof Uu.HTMLElement&&!cct(e,"boxSizing",/border-box/)},text:'Consider adding CSS "box-sizing: border-box" to this resizable element',getInfo({element:n}){return[n,sSe.boxSizing]}},{name:cR.noListeners,perform(n){const e=n.prepared.name;return!(n.interactable.events.types[`${e}move`]||[]).length},getInfo(n){return[n.prepared.name,n.interactable]},text:"There are no listeners set for this action"}];function cct(n,e,t){const i=n.style[e]||L0.getComputedStyle(n)[e];return t.test((i||"").toString())}function SGn(n,e,t){let i=n;for(;ut.element(i);){if(cct(i,e,t))return!0;i=I0(i)}return!1}const EGn="dev-tools",xGn={id:EGn,install:vGn,listeners:{"interactions:action-start":({interaction:n},e)=>{for(const t of lct){const i=n.interactable&&n.interactable.options;!(i&&i.devTools&&i.devTools.ignore[t.name])&&t.perform(n)&&e.logger.warn(act+t.text,...t.getInfo(n))}}},checks:lct,CheckName:cR,links:sSe,prefix:act},kGn=xGn;p_.use(kGn);function TGn(){const{appContext:n,proxy:e}=h.getCurrentInstance(),t=n.config.globalProperties;return{proxy:e,appContext:n,globalProperties:t}}const LGn={name:"GridItem"},dct=h.defineComponent({...LGn,props:{isDraggable:{type:[Boolean,null],default:null},isResizable:{type:[Boolean,null],default:null},isBounded:{type:[Boolean,null],default:null},static:{type:Boolean,default:!1},minH:{default:1},minW:{default:1},maxH:{default:1/0},maxW:{default:1/0},x:{},y:{},w:{},h:{},i:{},dragIgnoreFrom:{default:"a, button"},dragAllowFrom:{default:null},resizeIgnoreFrom:{default:"a, button"},preserveAspectRatio:{type:Boolean,default:!1},dragOption:{default:()=>({})},resizeOption:{default:()=>({})}},emits:["container-resized","resize","resized","move","moved","dragging","dragend"],setup(n,{expose:e,emit:t}){const i=n,{proxy:s}=TGn(),r=s==null?void 0:s.$parent,o=h.inject("eventBus"),a=h.ref({}),l=h.ref(1),c=h.ref(100),d=h.ref(30),u=h.ref([10,10]),f=h.ref(1/0),g=h.ref(null),p=h.ref(null),m=h.ref(1),A=h.ref(!0),b=h.ref(!0),y=h.ref(!1),_=h.ref(null),w=h.ref(!1),C=h.ref(null),E=h.ref(NaN),S=h.ref(NaN),x=h.ref(NaN),k=h.ref(NaN),I=h.ref({}),D=h.ref(!1),N=h.ref(!1),R=h.ref(!1),M=h.ref(null),B=h.ref(null),U=h.ref(null),H=h.ref(null),Q=h.ref(i.x),q=h.ref(i.y),ae=h.ref(i.w),J=h.ref(i.h),_e=h.ref(null),ue=h.ref(null),le=h.computed(()=>p.value&&!i.static),he=h.computed(()=>(g.value||p.value)&&!i.static),Xe=h.computed(()=>navigator.userAgent.toLowerCase().indexOf("android")!==-1),He=h.computed(()=>r!=null&&r.isMirrored?!D.value:D.value),we=h.computed(()=>({"vue-resizable":le.value,static:i.static,resizing:w.value,"vue-draggable-dragging":y.value,cssTransforms:A.value,"render-rtl":He.value,"disable-userselect":y.value,"no-touch":Xe.value&&he.value})),j=h.computed(()=>He.value?"vue-resizable-handle vue-rtl-resizable-handle":"vue-resizable-handle");h.watch(()=>i.isDraggable,me=>{g.value=me}),h.watch(()=>i.static,()=>{P(),ee()}),h.watch(g,()=>{P()}),h.watch(()=>i.isResizable,me=>{p.value=me}),h.watch(()=>i.isBounded,me=>{_e.value=me}),h.watch(p,()=>{ee()}),h.watch(d,()=>{Fn(),Xs()}),h.watch(l,()=>{ee(),Fn(),Xs()}),h.watch(c,()=>{ee(),Fn()}),h.watch(()=>i.x,me=>{Q.value=me,Fn()}),h.watch(()=>i.y,me=>{q.value=me,Fn()}),h.watch(()=>i.h,me=>{J.value=me,Fn()}),h.watch(()=>i.w,me=>{ae.value=me,Fn()}),h.watch(He,()=>{ee(),Fn()}),h.watch(()=>i.minH,()=>{ee()}),h.watch(()=>i.maxH,()=>{ee()}),h.watch(()=>i.minW,()=>{ee()}),h.watch(()=>i.maxW,()=>{ee()}),h.watch(()=>r==null?void 0:r.margin,me=>{!me||me[0]==u.value[0]&&me[1]==u.value[1]||(u.value=me.map(nt=>Number(nt)),Fn(),Xs())});function X(me){G(me)}function ge(me){F()}function de(me){i.isDraggable===null&&(g.value=me)}function Je(me){i.isResizable===null&&(p.value=me)}function it(me){i.isBounded===null&&(_e.value=me)}function ye(me){m.value=me}function $e(me){d.value=me}function ve(me){f.value=me}function Pt(){D.value=blt()==="rtl",F()}function li(me){const nt=me.toString();l.value=parseInt(nt)}o.on("updateWidth",X),o.on("compact",ge),o.on("setDraggable",de),o.on("setResizable",Je),o.on("setBounded",it),o.on("setTransformScale",ye),o.on("setRowHeight",$e),o.on("setMaxRows",ve),o.on("directionchange",Pt),o.on("setColNum",li),D.value=blt()==="rtl",h.onBeforeUnmount(()=>{o.off("updateWidth",X),o.off("compact",ge),o.off("setDraggable",de),o.off("setResizable",Je),o.off("setBounded",it),o.off("setTransformScale",ye),o.off("setRowHeight",$e),o.off("setMaxRows",ve),o.off("directionchange",Pt),o.off("setColNum",li),ue.value&&ue.value.unset()}),h.onMounted(()=>{r!=null&&r.responsive&&r.lastBreakpoint?l.value=F1e(r.lastBreakpoint,r==null?void 0:r.cols):l.value=r==null?void 0:r.colNum,d.value=r==null?void 0:r.rowHeight,c.value=(r==null?void 0:r.width)!==null?r==null?void 0:r.width:100,u.value=(r==null?void 0:r.margin)!==void 0?r.margin:[10,10],f.value=r==null?void 0:r.maxRows,i.isDraggable===null?g.value=r==null?void 0:r.isDraggable:g.value=i.isDraggable,i.isResizable===null?p.value=r==null?void 0:r.isResizable:p.value=i.isResizable,i.isBounded===null?_e.value=r==null?void 0:r.isBounded:_e.value=i.isBounded,m.value=r==null?void 0:r.transformScale,A.value=r==null?void 0:r.useCssTransforms,b.value=r==null?void 0:r.useStyleCursor,Fn()});function Fn(){var me,nt,At,cn,kn;i.x+i.w>l.value?(Q.value=0,ae.value=i.w>l.value?l.value:i.w):(Q.value=i.x,ae.value=i.w);let Ot=Hi(Q.value,q.value,ae.value,J.value);y.value&&(Ot.top=(me=_.value)==null?void 0:me.top,He.value?Ot.right=(nt=_.value)==null?void 0:nt.left:Ot.left=(At=_.value)==null?void 0:At.left),w.value&&(Ot.width=(cn=C.value)==null?void 0:cn.width,Ot.height=(kn=C.value)==null?void 0:kn.height);let fs;A.value?He.value?fs=Qqn(Ot.top,Ot.right,Ot.width,Ot.height):fs=zqn(Ot.top,Ot.left,Ot.width,Ot.height):He.value?fs=Kqn(Ot.top,Ot.right,Ot.width,Ot.height):fs=qqn(Ot.top,Ot.left,Ot.width,Ot.height),I.value=fs}function Xs(){let me={};for(let nt of["width","height"]){let At=I.value[nt].match(/^(\d+)px$/);if(!At)return;me[nt]=At[1]}t("container-resized",i.i,i.h,i.w,me.height,me.width)}function qo(me){var nt,At,cn;{if(i.static)return;const kn=glt(me);if(kn==null)return;const{x:Ot,y:fs}=kn,Gn={width:0,height:0};let hi;switch(me.type){case"resizestart":{ee(),M.value=ae.value,B.value=J.value,hi=Hi(Q.value,q.value,ae.value,J.value),Gn.width=hi.width,Gn.height=hi.height,C.value=Gn,w.value=!0;break}case"resizemove":{const xi=plt(x.value,k.value,Ot,fs);He.value?Gn.width=Number((nt=C.value)==null?void 0:nt.width)-xi.deltaX/m.value:Gn.width=Number((At=C.value)==null?void 0:At.width)+xi.deltaX/m.value,Gn.height=Number((cn=C.value)==null?void 0:cn.height)+xi.deltaY/m.value,C.value=Gn;break}case"resizeend":{hi=Hi(Q.value,q.value,ae.value,J.value),Gn.width=hi.width,Gn.height=hi.height,C.value=null,w.value=!1;break}}hi=Or(Gn.height,Gn.width),hi.w<i.minW&&(hi.w=i.minW),hi.w>i.maxW&&(hi.w=i.maxW),hi.h<i.minH&&(hi.h=i.minH),hi.h>i.maxH&&(hi.h=i.maxH),hi.h<1&&(hi.h=1),hi.w<1&&(hi.w=1),x.value=Ot,k.value=fs,(ae.value!==hi.w||J.value!==hi.h)&&t("resize",i.i,hi.h,hi.w,Gn.height,Gn.width),me.type==="resizeend"&&(M.value!==ae.value||B.value!==J.value)&&t("resized",i.i,hi.h,hi.w,Gn.height,Gn.width);const rb={eventType:me.type,i:i.i,x:Q.value,y:q.value,h:hi.h,w:hi.w};o.emit("resizeEvent",rb)}}function oo(me){var nt,At,cn;if(i.static||w.value)return;const kn=glt(me);if(kn===null)return;const{x:Ot,y:fs}=kn;let Gn={top:0,left:0};switch(me.type){case"dragstart":{U.value=Q.value,H.value=q.value;const xi=me.target;let jt=xi.offsetParent.getBoundingClientRect(),Y=xi.getBoundingClientRect();const Z=Y.left/m.value,ie=jt.left/m.value,fe=Y.right/m.value,Ce=jt.right/m.value,Le=Y.top/m.value,Ve=jt.top/m.value;He.value?Gn.left=(fe-Ce)*-1:Gn.left=Z-ie,Gn.top=Le-Ve,_.value=Gn,y.value=!0;break}case"dragend":{if(!y.value)return;t("dragend",me,i.i);const xi=me.target;let jt=xi.offsetParent.getBoundingClientRect(),Y=xi.getBoundingClientRect();const Z=Y.left/m.value,ie=jt.left/m.value,fe=Y.right/m.value,Ce=jt.right/m.value,Le=Y.top/m.value,Ve=jt.top/m.value;He.value?Gn.left=(fe-Ce)*-1:Gn.left=Z-ie,Gn.top=Le-Ve,_.value=null,y.value=!1;break}case"dragmove":{t("dragging",me,i.i);const xi=plt(E.value,S.value,Ot,fs);if(He.value?Gn.left=Number((nt=_.value)==null?void 0:nt.left)-xi.deltaX/m.value:Gn.left=Number((At=_.value)==null?void 0:At.left)+xi.deltaX/m.value,Gn.top=Number((cn=_.value)==null?void 0:cn.top)+xi.deltaY/m.value,_e.value){const jt=me.target.offsetParent.clientHeight-Fr(i.h,d.value,u.value[1]);Gn.top=Ei(Gn.top,0,jt);const Y=Zs(),Z=c.value-Fr(i.w,Y,u.value[0]);Gn.left=Ei(Gn.left,0,Z)}_.value=Gn;break}}let hi;He.value,hi=qi(Gn.top,Gn.left),E.value=Ot,S.value=fs,(Q.value!==hi.x||q.value!==hi.y)&&t("move",i.i,hi.x,hi.y),me.type==="dragend"&&(U.value!==Q.value||H.value!==q.value)&&t("moved",i.i,hi.x,hi.y);const rb={eventType:me.type,i:i.i,x:hi.x,y:hi.y,h:J.value,w:ae.value};o.emit("dragEvent",rb)}function Hi(me,nt,At,cn){const kn=Zs();let Ot;return He.value?Ot={right:Math.round(kn*me+(me+1)*u.value[0]),top:Math.round(d.value*nt+(nt+1)*u.value[1]),width:At===1/0?At:Math.round(kn*At+Math.max(0,At-1)*u.value[0]),height:cn===1/0?cn:Math.round(d.value*cn+Math.max(0,cn-1)*u.value[1])}:Ot={left:Math.round(kn*me+(me+1)*u.value[0]),top:Math.round(d.value*nt+(nt+1)*u.value[1]),width:At===1/0?At:Math.round(kn*At+Math.max(0,At-1)*u.value[0]),height:cn===1/0?cn:Math.round(d.value*cn+Math.max(0,cn-1)*u.value[1])},Ot}function qi(me,nt){const At=Zs();let cn=Math.round((nt-u.value[0])/(At+u.value[0])),kn=Math.round((me-u.value[1])/(d.value+u.value[1]));return cn=Math.max(Math.min(cn,l.value-ae.value),0),kn=Math.max(Math.min(kn,f.value-J.value),0),{x:cn,y:kn}}function Zs(){return(c.value-u.value[0]*(l.value+1))/l.value}function Fr(me,nt,At){return Number.isFinite(me)?Math.round(nt*me+Math.max(0,me-1)*At):me}function Ei(me,nt,At){return Math.max(Math.min(me,At),nt)}function Or(me,nt,At=!1){const cn=Zs();let kn=Math.round((nt+u.value[0])/(cn+u.value[0])),Ot=0;return At?Ot=Math.ceil((me+u.value[1])/(d.value+u.value[1])):Ot=Math.round((me+u.value[1])/(d.value+u.value[1])),kn=Math.max(Math.min(kn,l.value-Q.value),0),Ot=Math.max(Math.min(Ot,f.value-q.value),0),{w:kn,h:Ot}}function G(me,nt){c.value=me}function F(me){Fn()}function P(){if((ue.value===null||ue.value===void 0)&&(ue.value=p_(a.value),b.value||ue.value.styleCursor(!1)),g.value&&!i.static){const me={ignoreFrom:i.dragIgnoreFrom,allowFrom:i.dragAllowFrom,...i.dragOption};ue.value.draggable(me),N.value||(N.value=!0,ue.value.on("dragstart dragmove dragend",function(nt){oo(nt)}))}else ue.value.draggable({enabled:!1})}function ee(){if((ue.value===null||ue.value===void 0)&&(ue.value=p_(a.value),b.value||ue.value.styleCursor(!1)),p.value&&!i.static){let me=Hi(0,0,i.maxW,i.maxH),nt=Hi(0,0,i.minW,i.minH);const At={edges:{left:!1,right:"."+j.value.trim().replace(" ","."),bottom:"."+j.value.trim().replace(" ","."),top:!1},ignoreFrom:i.resizeIgnoreFrom,restrictSize:{min:{height:nt.height*m.value,width:nt.width*m.value},max:{height:me.height*m.value,width:me.width*m.value}},...i.resizeOption};i.preserveAspectRatio&&(At.modifiers=[p_.modifiers.aspectRatio({ratio:"preserve"})]),ue.value.resizable(At),R.value||(R.value=!0,ue.value.on("resizestart resizemove resizeend",function(cn){qo(cn)}))}else ue.value.resizable({enabled:!1})}const be=h.useSlots();function Te(){M.value=ae.value,B.value=J.value;let me=be==null?void 0:be.default[0].elm.getBoundingClientRect(),nt=Or(me.height,me.width,!0);if(nt.w<i.minW&&(nt.w=i.minW),nt.w>i.maxW&&(nt.w=i.maxW),nt.h<i.minH&&(nt.h=i.minH),nt.h>i.maxH&&(nt.h=i.maxH),nt.h<1&&(nt.h=1),nt.w<1&&(nt.w=1),(ae.value!==nt.w||J.value!==nt.h)&&t("resize",i.i,nt.h,nt.w,me.height,me.width),M.value!==nt.w||B.value!==nt.h){t("resized",i.i,nt.h,nt.w,me.height,me.width);const At={eventType:"resizeend",i:i.i,x:Q.value,y:q.value,h:nt.h,w:nt.w};o.emit("resizeEvent",At)}}return e({autoSize:Te,calcXY:qi,dragging:_,...i}),(me,nt)=>(h.openBlock(),h.createElementBlock("div",{ref_key:"this$refsItem",ref:a,class:h.normalizeClass(["vue-grid-item",we.value]),style:h.normalizeStyle(I.value)},[h.renderSlot(me.$slots,"default",{style:h.normalizeStyle(I.value)}),le.value?(h.openBlock(),h.createElementBlock("span",{key:0,ref:"handle",class:h.normalizeClass(j.value)},null,2)):h.createCommentVNode("",!0)],6))}});function IGn(n){return{all:n=n||new Map,on:function(e,t){var i=n.get(e);i?i.push(t):n.set(e,[t])},off:function(e,t){var i=n.get(e);i&&(t?i.splice(i.indexOf(t)>>>0,1):n.set(e,[]))},emit:function(e,t){var i=n.get(e);i&&i.slice().map(function(s){s(t)}),(i=n.get("*"))&&i.slice().map(function(s){s(e,t)})}}}var rSe={exports:{}},DGn=rSe.exports={};DGn.forEach=function(n,e){for(var t=0;t<n.length;t++){var i=e(n[t]);if(i)return i}};var NGn=function(n){var e=n.stateHandler.getState;function t(o){var a=e(o);return a&&!!a.isDetectable}function i(o){e(o).isDetectable=!0}function s(o){return!!e(o).busy}function r(o,a){e(o).busy=!!a}return{isDetectable:t,markAsDetectable:i,isBusy:s,markBusy:r}},RGn=function(n){var e={};function t(o){var a=n.get(o);return a===void 0?[]:e[a]||[]}function i(o,a){var l=n.get(o);e[l]||(e[l]=[]),e[l].push(a)}function s(o,a){for(var l=t(o),c=0,d=l.length;c<d;++c)if(l[c]===a){l.splice(c,1);break}}function r(o){var a=t(o);!a||(a.length=0)}return{get:t,add:i,removeListener:s,removeAllListeners:r}},MGn=function(){var n=1;function e(){return n++}return{generate:e}},BGn=function(n){var e=n.idGenerator,t=n.stateHandler.getState;function i(r){var o=t(r);return o&&o.id!==void 0?o.id:null}function s(r){var o=t(r);if(!o)throw new Error("setId required the element to have a resize detection state.");var a=e.generate();return o.id=a,a}return{get:i,set:s}},FGn=function(n){function e(){}var t={log:e,warn:e,error:e};if(!n&&window.console){var i=function(s,r){s[r]=function(){var o=console[r];if(o.apply)o.apply(console,arguments);else for(var a=0;a<arguments.length;a++)o(arguments[a])}};i(t,"log"),i(t,"warn"),i(t,"error")}return t},oSe={exports:{}},uct=oSe.exports={};uct.isIE=function(n){function e(){var i=navigator.userAgent.toLowerCase();return i.indexOf("msie")!==-1||i.indexOf("trident")!==-1||i.indexOf(" edge/")!==-1}if(!e())return!1;if(!n)return!0;var t=(function(){var i,s=3,r=document.createElement("div"),o=r.getElementsByTagName("i");do r.innerHTML="<!--[if gt IE "+ ++s+"]><i></i><![endif]-->";while(o[0]);return s>4?s:i})();return n===t},uct.isLegacyOpera=function(){return!!window.opera};var hct={exports:{}},OGn=hct.exports={};OGn.getOption=PGn;function PGn(n,e,t){var i=n[e];return i==null&&t!==void 0?t:i}var fct=hct.exports,VGn=function(n){n=n||{};var e=n.reporter,t=fct.getOption(n,"async",!0),i=fct.getOption(n,"auto",!0);i&&!t&&(e&&e.warn("Invalid options combination. auto=true and async=false is invalid. Setting async=true."),t=!0);var s=gct(),r,o=!1;function a(g,p){!o&&i&&t&&s.size()===0&&d(),s.add(g,p)}function l(){for(o=!0;s.size();){var g=s;s=gct(),g.process()}o=!1}function c(g){o||(g===void 0&&(g=t),r&&(u(r),r=null),g?d():l())}function d(){r=f(l)}function u(g){var p=clearTimeout;return p(g)}function f(g){var p=function(m){return setTimeout(m,0)};return p(g)}return{add:a,force:c}};function gct(){var n={},e=0,t=0,i=0;function s(a,l){l||(l=a,a=0),a>t?t=a:a<i&&(i=a),n[a]||(n[a]=[]),n[a].push(l),e++}function r(){for(var a=i;a<=t;a++)for(var l=n[a],c=0;c<l.length;c++){var d=l[c];d()}}function o(){return e}return{add:s,process:r,size:o}}var aSe="_erd";function UGn(n){return n[aSe]={},pct(n)}function pct(n){return n[aSe]}function HGn(n){delete n[aSe]}var $Gn={initState:UGn,getState:pct,cleanState:HGn},rV=oSe.exports,WGn=function(n){n=n||{};var e=n.reporter,t=n.batchProcessor,i=n.stateHandler.getState;if(!e)throw new Error("Missing required dependency: reporter.");function s(c,d){function u(){d(c)}if(rV.isIE(8))i(c).object={proxy:u},c.attachEvent("onresize",u);else{var f=a(c);if(!f)throw new Error("Element is not detectable by this strategy.");f.contentDocument.defaultView.addEventListener("resize",u)}}function r(c){var d=n.important?" !important; ":"; ";return(c.join(d)+d).trim()}function o(c,d,u){u||(u=d,d=c,c=null),c=c||{},c.debug;function f(g,p){var m=r(["display: block","position: absolute","top: 0","left: 0","width: 100%","height: 100%","border: none","padding: 0","margin: 0","opacity: 0","z-index: -1000","pointer-events: none"]),A=!1,b=window.getComputedStyle(g),y=g.offsetWidth,_=g.offsetHeight;i(g).startSize={width:y,height:_};function w(){function C(){if(b.position==="static"){g.style.setProperty("position","relative",c.important?"important":"");var x=function(k,I,D,N){function R(B){return B.replace(/[^-\d\.]/g,"")}var M=D[N];M!=="auto"&&R(M)!=="0"&&(k.warn("An element that is positioned static has style."+N+"="+M+" which is ignored due to the static positioning. The element will need to be positioned relative, so the style."+N+" will be set to 0. Element: ",I),I.style.setProperty(N,"0",c.important?"important":""))};x(e,g,b,"top"),x(e,g,b,"right"),x(e,g,b,"bottom"),x(e,g,b,"left")}}function E(){A||C();function x(I,D){if(!I.contentDocument){var N=i(I);N.checkForObjectDocumentTimeoutId&&window.clearTimeout(N.checkForObjectDocumentTimeoutId),N.checkForObjectDocumentTimeoutId=setTimeout(function(){N.checkForObjectDocumentTimeoutId=0,x(I,D)},100);return}D(I.contentDocument)}var k=this;x(k,function(I){p(g)})}b.position!==""&&(C(),A=!0);var S=document.createElement("object");S.style.cssText=m,S.tabIndex=-1,S.type="text/html",S.setAttribute("aria-hidden","true"),S.onload=E,rV.isIE()||(S.data="about:blank"),i(g)&&(g.appendChild(S),i(g).object=S,rV.isIE()&&(S.data="about:blank"))}t?t.add(w):w()}rV.isIE(8)?u(d):f(d,u)}function a(c){return i(c).object}function l(c){if(i(c)){var d=a(c);!d||(rV.isIE(8)?c.detachEvent("onresize",d.proxy):c.removeChild(d),i(c).checkForObjectDocumentTimeoutId&&window.clearTimeout(i(c).checkForObjectDocumentTimeoutId),delete i(c).object)}}return{makeDetectable:o,addListener:s,uninstall:l}},zGn=rSe.exports.forEach,QGn=function(n){n=n||{};var e=n.reporter,t=n.batchProcessor,i=n.stateHandler.getState;n.stateHandler.hasState;var s=n.idHandler;if(!t)throw new Error("Missing required dependency: batchProcessor");if(!e)throw new Error("Missing required dependency: reporter.");var r=d(),o="erd_scroll_detection_scrollbar_style",a="erd_scroll_detection_container";function l(w){u(w,o,a)}l(window.document);function c(w){var C=n.important?" !important; ":"; ";return(w.join(C)+C).trim()}function d(){var w=500,C=500,E=document.createElement("div");E.style.cssText=c(["position: absolute","width: "+w*2+"px","height: "+C*2+"px","visibility: hidden","margin: 0","padding: 0"]);var S=document.createElement("div");S.style.cssText=c(["position: absolute","width: "+w+"px","height: "+C+"px","overflow: scroll","visibility: none","top: "+-w*3+"px","left: "+-C*3+"px","visibility: hidden","margin: 0","padding: 0"]),S.appendChild(E),document.body.insertBefore(S,document.body.firstChild);var x=w-S.clientWidth,k=C-S.clientHeight;return document.body.removeChild(S),{width:x,height:k}}function u(w,C,E){function S(D,N){N=N||function(M){w.head.appendChild(M)};var R=w.createElement("style");return R.innerHTML=D,R.id=C,N(R),R}if(!w.getElementById(C)){var x=E+"_animation",k=E+"_animation_active",I=`/* Created by the element-resize-detector library. */
2906
2906
  `;I+="."+E+" > div::-webkit-scrollbar { "+c(["display: none"])+` }
2907
2907