/* COPYRIGHT Esri - https://js.arcgis.com/5.1.2/LICENSE.txt */
import{__decorate as t,__param as e}from"tslib";import{location as r,uniform as o,texture as i,input as s}from"../../GraphShaderModule.js";import{Vec4 as l,Float as n,Sampler2D as a,Vec2 as p,Vec3 as u,mod as d,mix as c,texture2D as m,Mat3 as f,negate as y}from"../../graph/glsl.js";import{BaseHittestVertexInput as x,FeatureFragmentInput as v}from"./AFeatureShader.js";import{FillVertexInput as b,FillShader as h}from"./FillShader.js";import{LocalTileOffset as w}from"./LocalTileOffset.js";import{MosaicInfo as g}from"./MosaicInfo.js";class T extends b{}t([r(5,l)],T.prototype,"tlbr",void 0),t([r(6,n)],T.prototype,"inverseRasterizationScale",void 0);class j extends v{}function O(t){const e=new n(1),r=new n(0);return new f(e.divide(t.x),r.divide(t.y),0,y(r.divide(t.x)),e.divide(t.y),0,0,0,1)}function S(t,e){const r=e.tlbr.xy,o=e.tlbr.zw,i=o.x.subtract(r.x),s=r.y.subtract(o.y),l=new p(i,s).multiply(e.inverseRasterizationScale),n=l.multiply(t.view.requiredZoomFactor),a=O(n),d=t.localTileOffset.getPatternOffsetAtTileOrigin(l).divide(n),c=new u(e.pos,1);return{tileTextureCoord:a.multiply(c).xy.subtract(d),tlbr:e.tlbr.divide(t.mosaicInfo.size.xyxy)}}function z(t,e){const r=d(t.tileTextureCoord,new n(1)),o=c(t.tlbr.xy,t.tlbr.zw,r),i=m(e.mosaicTexture,o);return t.color.multiply(i)}class F extends h{constructor(){super(...arguments),this.type="PatternFillShader"}vertex(t,e){return{...super.vertex(t,e),...S(this,t)}}fragment(t){const e=z(t,this);return this.getFragmentOutput(e,t,new n(0))}}t([o(g)],F.prototype,"mosaicInfo",void 0),t([i(a)],F.prototype,"mosaicTexture",void 0),t([o(w)],F.prototype,"localTileOffset",void 0),t([e(0,s(T)),e(1,s(x))],F.prototype,"vertex",null),t([e(0,s(j))],F.prototype,"fragment",null);export{j as PatternFillFragmentInput,F as PatternFillShader,T as PatternFillVertexInput,z as getPatternFillFragmentColor,S as getPatternFillVertexData};
