/*
All material copyright Esri, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
*/
import{clone as t}from"../../../core/lang.js";import{getStroke as o,getFill as e}from"../../../symbols/support/gfxUtils.js";import{getSymbolLayerFill as r}from"../../../symbols/support/previewSymbol3D.js";const s={HH:315,HL:45,LL:135,LH:225},l={2:[["HL","HH"],["LL","LH"]],3:[["HL","HM","HH"],["ML","MM","MH"],["LL","LM","LH"]],4:[["HL","HM1","HM2","HH"],["M2L","M2M1","M2M2","M2H"],["M1L","M1M1","M1M2","M1H"],["LL","LM1","LM2","LH"]]};function n(t){if(!t)return;const{type:s}=t;if(s.includes("3d"))return r(t.symbolLayers.at(0));if("simple-line"===s){const e=o(t);return e&&e.color}if("simple-marker"===t.type&&("x"===t.style||"cross"===t.style)){const e=o(t);return e&&e.color}return e(t)}function H(t,o){const e=o.HH.label,r=o.LL.label,s=o.HL.label,l=o.LH.label;switch(t){case"HH":default:return{top:e,bottom:r,left:s,right:l};case"HL":return{top:s,bottom:l,left:r,right:e};case"LL":return{top:r,bottom:e,left:l,right:s};case"LH":return{top:l,bottom:s,left:e,right:r}}}function L(o,e){const r=[],s=o.length**.5,l=t(o),n=(e||"HH").split(""),H=n[0],L="H"===n[1];for(;l.length;){const t=[];for(;t.length<s;)t.push(l.shift());L&&t.reverse(),r.push(t)}return"L"===H&&r.reverse(),r}function i(t){const{focus:o,infos:e,numClasses:r}=t,s=l[r],L={};e.forEach(t=>{L[t.value]={label:t.label,fill:n(t.symbol)}});const i=[];for(let l=0;l<r;l++){const t=[];for(let o=0;o<r;o++){const e=L[s[l][o]];t.push(e.fill)}i.push(t)}return{type:"relationship-ramp",numClasses:r,focus:o,colors:i,labels:H(o,L),rotation:u(o)}}function u(t){let o=s[t];return t&&null==o&&(o=s.HH),o||0}export{L as getRelationshipRampColors2D,i as getRelationshipRampElement,u as getRotationAngleForFocus};
